Description of problem: When adding custom attributes via the api on the OpenShift provider, user has the ability to successfully add duplicate entries. Version-Release number of selected component (if applicable): 5.9.0.20 How reproducible: 100% Steps to Reproduce: 1. Add a custom attribute via the api example: POST /api/providers/1/custom_attributes { "action" : "add", "resources" : [ { "name" : "koko", "value" : "moko" } ] } 2. Verify the custom attribute was added successfully 3. Add the same custom attribute via the api Actual results: Duplicate custom attributes appear Expected results: Would expect for some 409 returned code and json that explains that this custom attribute is already exists Additional info:
https://github.com/ManageIQ/manageiq-api/pull/320
New commit detected on ManageIQ/manageiq-api/master: https://github.com/ManageIQ/manageiq-api/commit/5dff1e383aeef4d94befee7b3b17f3e44e6f2cf5 commit 5dff1e383aeef4d94befee7b3b17f3e44e6f2cf5 Author: Jillian Tullo <jtullo> AuthorDate: Wed Feb 14 07:37:45 2018 -0500 Commit: Jillian Tullo <jtullo> CommitDate: Wed Feb 14 07:37:45 2018 -0500 Default section to "metadata" across custom attributes add action When a new custom attribute is added, it defaults the section to "metadata" when the section is not specified. This causes issues if the request is then made again, especially because the default behavior for "add" is to edit. Without defaulting the section to "metadata" across the board, a new custom attribute is created, rather than updated. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1544800 .../api/subcollections/custom_attributes.rb | 2 +- spec/requests/custom_attributes_spec.rb | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-)
Verified on 5.10.0.20.20181016163900_fe677b4 that adding a custom attribute with the same name as an existing attribute updates the existing attribute.