Skip to content

Commit

Permalink
PLT-658: resolving merge conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikchern committed Sep 27, 2023
1 parent 0e5c1db commit 4aacef7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ require (
)

//replace github.com/spectrocloud/hapi => ../hapi
replace github.com/spectrocloud/palette-sdk-go => ../palette-sdk-go
//replace github.com/spectrocloud/palette-sdk-go => ../palette-sdk-go
5 changes: 4 additions & 1 deletion spectrocloud/cluster_common_fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ func readCommonFields(c *client.V1Client, d *schema.ResourceData, cluster *model

clusterAdditionalMeta := cluster.Spec.ClusterConfig.ClusterMetaAttribute
if clusterAdditionalMeta != "" {
d.Set("cluster_meta_attribute", clusterAdditionalMeta)
err := d.Set("cluster_meta_attribute", clusterAdditionalMeta)
if err != nil {
return diag.FromErr(err), true
}
}

hostConfig := cluster.Spec.ClusterConfig.HostClusterConfig
Expand Down
19 changes: 11 additions & 8 deletions spectrocloud/cluster_common_hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,23 +367,26 @@ func HashStringMapList(v interface{}) string {
}

func HashStringMap(v interface{}) string {
if v == nil || len(v.(map[string]interface{})) == 0 {
if v == nil {
return ""
}

m, ok := v.(map[string]interface{})
if !ok || len(m) == 0 {
return ""
}

var b bytes.Buffer
m := v.(map[string]interface{})

keys := make([]string, 0)
// Create and sort the keys
keys := make([]string, 0, len(m))
for k := range m {
keys = append(keys, k)
}
sort.Strings(keys)

sortedKeys := make([]string, len(keys))
copy(sortedKeys, keys)
sort.Strings(sortedKeys)

for _, k := range sortedKeys {
// Construct the string based on sorted keys
for _, k := range keys {
b.WriteString(fmt.Sprintf("%s-%s", k, m[k].(string)))
}

Expand Down

0 comments on commit 4aacef7

Please sign in to comment.