Skip to content

Commit

Permalink
Changed string pointer to string and removed nil check
Browse files Browse the repository at this point in the history
  • Loading branch information
tirthct committed Sep 27, 2023
1 parent 498c54e commit a9f32b7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cmd/ocm/create/cluster/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,11 @@ func GetDefaultClusterFlavors(connection *sdk.Connection, flavour string) (dMach
}

func getVersionOptions(connection *sdk.Connection) ([]arguments.Option, error) {
options, _, err := getVersionOptionsWithDefault(connection, "", nil)
options, _, err := getVersionOptionsWithDefault(connection, "", "")
return options, err
}

func getVersionOptionsWithDefault(connection *sdk.Connection, channelGroup string, gcpMarketplaceEnabled *string) (
func getVersionOptionsWithDefault(connection *sdk.Connection, channelGroup string, gcpMarketplaceEnabled string) (
options []arguments.Option, defaultVersion string, err error,
) {
// Check and set the cluster version
Expand Down Expand Up @@ -557,7 +557,7 @@ func preRun(cmd *cobra.Command, argv []string) error {
gcpMarketplaceEnabled = strconv.FormatBool(isGcpMarketplaceSubscriptionType)
}
versions, defaultVersion, err := getVersionOptionsWithDefault(connection, args.channelGroup,
&gcpMarketplaceEnabled)
gcpMarketplaceEnabled)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ocm/list/version/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func run(cmd *cobra.Command, argv []string) error {
defer connection.Close()

client := connection.ClustersMgmt().V1()
versions, defaultVersion, err := cluster.GetEnabledVersions(client, args.channelGroup, &args.gcpMarketplace)
versions, defaultVersion, err := cluster.GetEnabledVersions(client, args.channelGroup, args.gcpMarketplace)
if err != nil {
return fmt.Errorf("Can't retrieve versions: %v", err)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/cluster/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ func EnsureOpenshiftVPrefix(v string) string {
// GetEnabledVersions returns the versions with enabled=true, and the one that has default=true.
// The returned strings are the IDs without "openshift-v" prefix (e.g. "4.6.0-rc.4-candidate")
// sorted in approximate SemVer order (handling of text parts is somewhat arbitrary).
func GetEnabledVersions(client *cmv1.Client, channelGroup string, gcpMarketplaceEnabled *string) (
func GetEnabledVersions(client *cmv1.Client, channelGroup string, gcpMarketplaceEnabled string) (
versions []string, defaultVersion string, err error) {
collection := client.Versions()
page := 1
size := 100
filter := "enabled = 'true'"
if gcpMarketplaceEnabled != nil && *gcpMarketplaceEnabled != "" {
filter = fmt.Sprintf("%s AND gcp_marketplace_enabled = '%s'", filter, *gcpMarketplaceEnabled)
if gcpMarketplaceEnabled != "" {
filter = fmt.Sprintf("%s AND gcp_marketplace_enabled = '%s'", filter, gcpMarketplaceEnabled)
}
if channelGroup != "" {
filter = fmt.Sprintf("%s AND channel_group = '%s'", filter, channelGroup)
Expand Down

0 comments on commit a9f32b7

Please sign in to comment.