From 26e1ae093482340eae8bf7f7aa6a3bb7af74f095 Mon Sep 17 00:00:00 2001 From: Balazs Czoma Date: Thu, 2 Nov 2023 12:08:53 -0400 Subject: [PATCH] Removed broker check from the config generator + renamed func --- cmd/generate.go | 17 ----------------- internal/broker/provider.go | 2 +- internal/broker/resource.go | 2 +- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/cmd/generate.go b/cmd/generate.go index 14dc824..7151ba8 100644 --- a/cmd/generate.go +++ b/cmd/generate.go @@ -18,14 +18,12 @@ package cmd import ( "context" "fmt" - "net/http" "os" "strings" "terraform-provider-solacebroker/cmd/broker" command "terraform-provider-solacebroker/cmd/command" "terraform-provider-solacebroker/internal/semp" - "github.com/hashicorp/go-version" "github.com/spf13/cobra" "golang.org/x/exp/maps" ) @@ -85,21 +83,6 @@ This command would create a file my-messagevpn.tf that contains a resource defin fileName = fileName + ".tf" } - //Confirm SEMP version and connection via client - aboutPath := "/about/api" - result, err := client.RequestWithoutBody(cmd.Context(), http.MethodGet, aboutPath) - if err != nil { - command.LogCLIError("SEMP call failed. " + err.Error()) - os.Exit(1) - } - brokerSempVersion, err := version.NewVersion(result["sempVersion"].(string)) - if err != nil { - command.LogCLIError("Unable to parse SEMP version from API") - os.Exit(1) - } - command.LogCLIInfo("Connection successful") - command.LogCLIInfo("Broker SEMP version is " + brokerSempVersion.String()) - command.LogCLIInfo("Attempt generation for broker object: " + brokerObjectType + " of " + providerSpecificIdentifier + " in file " + fileName) object := &command.ObjectInfo{} diff --git a/internal/broker/provider.go b/internal/broker/provider.go index 4614794..f927ec5 100644 --- a/internal/broker/provider.go +++ b/internal/broker/provider.go @@ -108,7 +108,7 @@ func (p *BrokerProvider) Configure(ctx context.Context, req provider.ConfigureRe resp.ResourceData = &config resp.DataSourceData = &config - resetBrokerRequirementsCheck() + forceBrokerRequirementsCheck() } func (p *BrokerProvider) Resources(_ context.Context) []func() resource.Resource { diff --git a/internal/broker/resource.go b/internal/broker/resource.go index 2b25c71..5a9a87e 100644 --- a/internal/broker/resource.go +++ b/internal/broker/resource.go @@ -76,7 +76,7 @@ const ( minRequiredBrokerSempApiVersion = "2.33" // Shipped with broker version 10.3 ) -func resetBrokerRequirementsCheck() { +func forceBrokerRequirementsCheck() { brokerAlreadyChecked = false }