mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 18:48:08 +00:00 
			
		
		
		
	updating hcp link structs, and fix diagnose (#17097)
This commit is contained in:
		| @@ -719,6 +719,12 @@ SEALFAIL: | |||||||
| 		diagnose.Skipped(ctx, "HCP link check will not run on OSS Vault.") | 		diagnose.Skipped(ctx, "HCP link check will not run on OSS Vault.") | ||||||
| 	} else { | 	} else { | ||||||
| 		if config.HCPLinkConf != nil { | 		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 { | 			diagnose.Test(ctx, "Check HCP Connection", func(ctx context.Context) error { | ||||||
| 				hcpLink, err := hcp_link.NewHCPLink(config.HCPLinkConf, vaultCore, server.logger) | 				hcpLink, err := hcp_link.NewHCPLink(config.HCPLinkConf, vaultCore, server.logger) | ||||||
| 				if err != nil || hcpLink == nil { | 				if err != nil || hcpLink == nil { | ||||||
| @@ -729,7 +735,7 @@ SEALFAIL: | |||||||
| 				deadline := time.Now().Add(5 * time.Second) | 				deadline := time.Now().Add(5 * time.Second) | ||||||
| 				linkSessionStatus := "disconnected" | 				linkSessionStatus := "disconnected" | ||||||
| 				for time.Now().Before(deadline) { | 				for time.Now().Before(deadline) { | ||||||
| 					linkSessionStatus = hcpLink.GetScadaSessionStatus() | 					linkSessionStatus = hcpLink.GetConnectionStatusMessage(hcpLink.GetScadaSessionStatus()) | ||||||
| 					if linkSessionStatus == "connected" { | 					if linkSessionStatus == "connected" { | ||||||
| 						break | 						break | ||||||
| 					} | 					} | ||||||
|   | |||||||
| @@ -17,3 +17,7 @@ func (h *WrappedHCPLinkVault) Shutdown() error { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (h *WrappedHCPLinkVault) GetScadaSessionStatus() string { return Disconnected } | func (h *WrappedHCPLinkVault) GetScadaSessionStatus() string { return Disconnected } | ||||||
|  |  | ||||||
|  | func (h *WrappedHCPLinkVault) GetConnectionStatusMessage(scadaStatus string) string { | ||||||
|  | 	return scadaStatus | ||||||
|  | } | ||||||
|   | |||||||
| @@ -17,4 +17,5 @@ type WrappedHCPLinkVault struct { | |||||||
| type HCPLinkVaultInterface interface { | type HCPLinkVaultInterface interface { | ||||||
| 	Shutdown() error | 	Shutdown() error | ||||||
| 	GetScadaSessionStatus() string | 	GetScadaSessionStatus() string | ||||||
|  | 	GetConnectionStatusMessage(string) string | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Hamid Ghaf
					Hamid Ghaf