Skip to content

Commit

Permalink
refactor provisioningParamsAreChanged, do not check sequence and the …
Browse files Browse the repository at this point in the history
…amount of parameters
  • Loading branch information
Kirill Sushkov (teeverr) committed Sep 26, 2023
1 parent 411752e commit ce8a8a1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/controller/servicecatalog/provisionedproduct/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ const (
)

func provisioningParamsAreChanged(cfStackParams []cfsdkv2types.Parameter, currentParams []*svcapitypes.ProvisioningParameter) bool {
if len(cfStackParams) != len(currentParams) {
return true
cfStackKeyValue := make(map[string]string)
for _, v := range cfStackParams {
cfStackKeyValue[*v.ParameterKey] = pointer.StringDeref(v.ParameterValue, "")
}

for i, v := range cfStackParams {
if pointer.StringDeref(currentParams[i].Key, "") != pointer.StringDeref(v.ParameterKey, "") ||
pointer.StringDeref(currentParams[i].Value, "") != pointer.StringDeref(v.ParameterValue, "") {
for _, v := range currentParams {
if cfv, ok := cfStackKeyValue[*v.Key]; ok && pointer.StringEqual(&cfv, v.Value) {
continue
} else {
return true
}
}
Expand Down

0 comments on commit ce8a8a1

Please sign in to comment.