Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mahesh-hpe committed Nov 5, 2024
1 parent 7cbfe32 commit ad9dd41
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/HewlettPackard/hpegl-vmaas-terraform-resources
go 1.21

require (
github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk v0.1.14-0.20241031081330-09bdd6eaa383
github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk v0.1.14-0.20241105053431-8961e26004b0
github.com/golang/mock v1.6.0
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/terraform-plugin-docs v0.9.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk v0.1.14-0.20241031081330-09bdd6eaa383 h1:W4U6n4DNm+6TcBHEPh2/KaWkb8jPWOBLsIUkUZqY9Mg=
github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk v0.1.14-0.20241031081330-09bdd6eaa383/go.mod h1:tsKOAAbEQnpXAzqjcZUGzRiVp9QfRViKoTOdIltIMFI=
github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk v0.1.14-0.20241105053431-8961e26004b0 h1:L0HOYrKmsCqssIiBZTYhaIQ9Vr8uqZo7g84oh7zsdPo=
github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk v0.1.14-0.20241105053431-8961e26004b0/go.mod h1:tsKOAAbEQnpXAzqjcZUGzRiVp9QfRViKoTOdIltIMFI=
github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
Expand Down
19 changes: 9 additions & 10 deletions pkg/utils/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,7 @@ func SetCMPVars(apiClient, brokerClient *client.APIClient, cfg *client.Configura
return
}
apiClient.SetHost(cmpDetails.URL)
ctx := context.Background()
ctx = context.WithValue(ctx, client.ContextAccessToken, cmpDetails.AccessToken)
err = apiClient.SetCMPVersion(ctx)
if err != nil {
log.Printf("[ERROR] Unable to set CMP version client: %s", err)
return
}
cfg.Host = cmpDetails.URL

apiClient.SetCMPMeta(nil, brokerClient, func(ctx *context.Context, meta interface{}) {
apiClient.SetMetaFnAndVersion(nil, 0, func(ctx *context.Context, meta interface{}) {
// Initialise token handler
cmpDetails, err := brokerClient.GetCMPDetails(*ctx)
if err != nil {
Expand All @@ -76,6 +67,14 @@ func SetCMPVars(apiClient, brokerClient *client.APIClient, cfg *client.Configura
*ctx = context.WithValue(*ctx, client.ContextAccessToken, cmpDetails.AccessToken)
}
})
ctx := context.Background()
ctx = context.WithValue(ctx, client.ContextAccessToken, cmpDetails.AccessToken)
err = apiClient.SetCMPVersion(ctx)
if err != nil {
log.Printf("[ERROR] Unable to set CMP version client: %s", err)
return
}
cfg.Host = cmpDetails.URL

return err
}

0 comments on commit ad9dd41

Please sign in to comment.