Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Ignores non-configurable properties when associating existing collection item GUIDs #504

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ can be found in [Pivotal Documentation](docs.pivotal.io/platform-automation).
This ensures that commands are not kept in `bash` history.
The environment variable `OM_PASSWORD` will overwrite the password value in `env.yml`.

## 6.1.3

### Bug Fixes
- `configure-product` will no longer assign a new guid for unnamed collections
- that haven't changed but contain non-configurable properties

## 6.1.2

### Bug Fixes
Expand Down
4 changes: 4 additions & 0 deletions api/staged_products_property_collection_guid_assigner.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ func (item responsePropertyCollectionItem) getFieldValuesExceptGUID() map[interf
if key == "guid" {
continue
}
isNotConfigurable := !valueObj.(map[interface{}]interface{})["configurable"].(bool)
if isNotConfigurable {
continue
}
extractedValues[key] = valueObj.(map[interface{}]interface{})["value"]
}

Expand Down
38 changes: 38 additions & 0 deletions api/staged_products_property_collection_guid_assigner_test.go.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,5 +302,43 @@ var _ = Describe("ResponsePropertyCollection", func() {
Expect(ok).To(BeTrue())
Expect(guid).To(Equal("28bab1d3-4a4b-48d5-8dac-two"))
})
It("ignores non-configurable properties when finding items that are equivalent", func() {
existingCollection, err := parseResponsePropertyCollection(unmarshalJSONLikeApiGetStagedProductProperties(`[
{
"guid": {
"type": "uuid",
"configurable": false,
"credential": false,
"value": "28bab1d3-4a4b-with-non-configurable-properties",
"optional": false
},
"non_configurable_property": {
"type": "string",
"configurable": false,
"credential": false,
"value": "this property can't be configured",
"optional": false
},
"configurable_property": {
"type": "string",
"configurable": true,
"credential": false,
"value": "this property can be configured",
"optional": false
}
}
]`))
Expect(err).To(BeNil())
updatedCollection, err := parseUpdatedPropertyCollection(unmarshalJSON(`{ "value":[
{
"configurable_property": "this property can be configured"
}
]}`))
Expect(err).To(BeNil())

guid, ok := existingCollection.findGUIDForEquivalentlItem(updatedCollection[0])
Expect(ok).To(BeTrue())
Expect(guid).To(Equal("28bab1d3-4a4b-with-non-configurable-properties"))
})
})
})