Skip to content

Commit

Permalink
Removed broker check from the config generator + renamed func
Browse files Browse the repository at this point in the history
  • Loading branch information
bczoma committed Nov 2, 2023
1 parent 5deda42 commit 26e1ae0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 19 deletions.
17 changes: 0 additions & 17 deletions cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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{}
Expand Down
2 changes: 1 addition & 1 deletion internal/broker/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/broker/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const (
minRequiredBrokerSempApiVersion = "2.33" // Shipped with broker version 10.3
)

func resetBrokerRequirementsCheck() {
func forceBrokerRequirementsCheck() {
brokerAlreadyChecked = false
}

Expand Down

0 comments on commit 26e1ae0

Please sign in to comment.