Skip to content

Commit

Permalink
OCM-6450 | No update cluster with empty config
Browse files Browse the repository at this point in the history
ocm edit will update always the cluster even there is no new
configuration. This commit checks the configuration before
make the update call.

Signed-off-by: Alba Hita Catala <[email protected]>
  • Loading branch information
ahitacat committed Mar 1, 2024
1 parent 1095264 commit 9cf11ef
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmd/ocm/edit/cluster/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package cluster
import (
"fmt"
"os"
"reflect"
"strings"
"time"

Expand Down Expand Up @@ -268,9 +269,11 @@ func run(cmd *cobra.Command, argv []string) error {
}
clusterConfig.ClusterWideProxy = clusterWideProxy

err = c.UpdateCluster(clusterCollection, cluster.ID(), clusterConfig)
if err != nil {
return fmt.Errorf("Failed to update cluster: %v", err)
if !reflect.ValueOf(clusterConfig).IsZero() {
err = c.UpdateCluster(clusterCollection, cluster.ID(), clusterConfig)
if err != nil {
return fmt.Errorf("Failed to update cluster: %v", err)
}
}

return nil
Expand Down

0 comments on commit 9cf11ef

Please sign in to comment.