Bug 1816003 - [RFE] Add the custom_attributes subcollection to hosts collection
Summary: [RFE] Add the custom_attributes subcollection to hosts collection
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.11.4
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.11.5
Assignee: Fabien Dupont
QA Contact: Md Nadeem
Red Hat CloudForms Documentation
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-03-23 07:00 UTC by Fabien Dupont
Modified: 2020-06-27 16:36 UTC (History)
5 users (show)

Fixed In Version: 5.11.5.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-05 13:43:34 UTC
Category: ---
Cloudforms Team: V2V
Target Upstream Version:
Embargoed:
pm-rhel: cfme-5.11.z+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github ManageIQ integration_tests pull 10222 0 None open [WIPTEST] New test: custom_attributes subcollection for hosts 2020-06-27 16:36:48 UTC
Red Hat Product Errata RHBA-2020:2020 0 None None None 2020-05-05 13:43:42 UTC

Description Fabien Dupont 2020-03-23 07:00:11 UTC
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.

Comment 2 Fabien Dupont 2020-03-23 09:45:13 UTC
https://github.com/ManageIQ/manageiq-api/pull/783

Comment 3 Fabien Dupont 2020-03-23 13:21:36 UTC
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

Comment 4 CFME Bot 2020-03-24 13:16:23 UTC
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(+)

Comment 6 Fabien Dupont 2020-04-22 15:58:40 UTC
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.

Comment 10 errata-xmlrpc 2020-05-05 13:43:34 UTC
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


Note You need to log in before you can comment on or make changes to this bug.