From ad9dd4105349e6df1d17e2d37ddd3006eedab3e1 Mon Sep 17 00:00:00 2001 From: Mahesh N Date: Tue, 5 Nov 2024 11:07:49 +0530 Subject: [PATCH] cleanup --- go.mod | 2 +- go.sum | 2 ++ pkg/utils/meta.go | 19 +++++++++---------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index ebad34b7..c4249a4a 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index f45b74e2..f381ab9d 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/pkg/utils/meta.go b/pkg/utils/meta.go index 3d4bc6df..9eb6ca2d 100644 --- a/pkg/utils/meta.go +++ b/pkg/utils/meta.go @@ -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 { @@ -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 }