Description of problem: The hosts collection doesn't support the custom_attributes subcollection, while the model Host class supports custom attributes. We want to use custom attributes to specify an IP address for V2V on VMware hosts, in order to make traffic go through the fastest NIC instead of admin NIC.
https://github.com/ManageIQ/manageiq-api/pull/783
To verify this BZ, one has to use the API. First, we create custom attributes: POST /api/hosts/:id/custom_attributes { "action": "add", "resources": [ { "name": "ca_1", "value": "value_1" }, { "name": "ca_2", "value": "value_2" } ] } Then, we edit a custom attribute: POST /api/hosts/:id/custom_attributes { "action": "edit", "resources": [ { "name": "ca_1", "value": "new_value_1" } ] } And finally delete a custom attribute: POST /api/hosts/:id/custom_attributes { "action": "delete", "resources": [ { "name": "ca_2", "value": "value_2" } ] } or POST /api/hosts/:id/custom_attributes/:ca_id
New commit detected on ManageIQ/manageiq-api/jansa: https://github.com/ManageIQ/manageiq-api/commit/54fc3e3f5e91aa0d413ec1508da1141f0ca28ed7 commit 54fc3e3f5e91aa0d413ec1508da1141f0ca28ed7 Author: Brandon Dunne <bdunne> AuthorDate: Mon Mar 23 13:11:53 2020 +0000 Commit: Brandon Dunne <bdunne> CommitDate: Mon Mar 23 13:11:53 2020 +0000 Merge pull request #783 from fdupont-redhat/bz_1816003 Add the custom_attributes subcollection to hosts collection (cherry picked from commit 3206d5152011555f4b15317665c68b9e89254c67) https://bugzilla.redhat.com/show_bug.cgi?id=1816003 app/controllers/api/hosts_controller.rb | 1 + config/api.yml | 9 + spec/requests/hosts_spec.rb | 122 + 3 files changed, 132 insertions(+)
There's an error in the API to change the custom attribute. There are 2 possible ways: one by one or bulk. One by one, you need to specify the id of the custom attribute in the URL: POST /api/hosts/:id/custom_attributes/:id { "action": "edit", "resource": { "name": "ca_2", "value": "value_2" } } Bulk, you need to specify the id(s) of the custom attribute(s) in the payload: POST /api/hosts/:id/custom_attributes { "action": "edit", "resources": [ { "id": 3, "value": "new_value_3" } ] } The documentation seems to be incorrect in that respect, so please open a BZ for CloudForms API.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:2020