updating hcp link structs, and fix diagnose (#17097)

This commit is contained in:
Hamid Ghaf 2022-09-12 11:10:01 -04:00 committed by GitHub
parent 71cb0a2ae5
commit a9138889f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -719,6 +719,12 @@ SEALFAIL:
diagnose.Skipped(ctx, "HCP link check will not run on OSS Vault.")
} else {
if config.HCPLinkConf != nil {
// we need to override API and Passthrough capabilities
// as they could not be initialized when Vault http handler
// is not fully initialized
config.HCPLinkConf.EnablePassThroughCapability = false
config.HCPLinkConf.EnableAPICapability = false
diagnose.Test(ctx, "Check HCP Connection", func(ctx context.Context) error {
hcpLink, err := hcp_link.NewHCPLink(config.HCPLinkConf, vaultCore, server.logger)
if err != nil || hcpLink == nil {
@ -729,7 +735,7 @@ SEALFAIL:
deadline := time.Now().Add(5 * time.Second)
linkSessionStatus := "disconnected"
for time.Now().Before(deadline) {
linkSessionStatus = hcpLink.GetScadaSessionStatus()
linkSessionStatus = hcpLink.GetConnectionStatusMessage(hcpLink.GetScadaSessionStatus())
if linkSessionStatus == "connected" {
break
}

View File

@ -17,3 +17,7 @@ func (h *WrappedHCPLinkVault) Shutdown() error {
}
func (h *WrappedHCPLinkVault) GetScadaSessionStatus() string { return Disconnected }
func (h *WrappedHCPLinkVault) GetConnectionStatusMessage(scadaStatus string) string {
return scadaStatus
}

View File

@ -17,4 +17,5 @@ type WrappedHCPLinkVault struct {
type HCPLinkVaultInterface interface {
Shutdown() error
GetScadaSessionStatus() string
GetConnectionStatusMessage(string) string
}