Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1325989 - GET/POST/PUT /api/v2/host_collections/ do not return 'host_ids' attribute
GET/POST/PUT /api/v2/host_collections/ do not return 'host_ids' attribute
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API (Show other bugs)
6.2.0
Unspecified Unspecified
unspecified Severity medium (vote)
: 6.2.2
: Unused
Assigned To: Brad Buckingham
jcallaha
: Regression, Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-04-11 10:14 EDT by Andrii Balakhtar
Modified: 2016-09-14 17:00 EDT (History)
4 users (show)

See Also:
Fixed In Version: rubygem-katello-3.0.0.74-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-09-14 17:00:04 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 14712 None None None 2016-04-22 12:08 EDT
Foreman Issue Tracker 15486 None None None 2016-06-21 12:59 EDT
Red Hat Product Errata RHBA-2016:1885 normal SHIPPED_LIVE Satellite 6.2.2 bug fix update 2016-09-14 20:57:56 EDT

  None (edit)
Description Andrii Balakhtar 2016-04-11 10:14:16 EDT
Description of problem:
As per 6.2 changes, host_collections now accept host ids instead of system ids. Creation of host collection with hosts associated is successful, however it seems not possible to validate it through API - none of GET/POST/PUT requests return 'host_ids' attribute.

Version-Release number of selected component (if applicable):
Satellite 6.2 Beta Snap7.1

How reproducible:
Always

Steps to Reproduce:
1. Create host collection with hosts specified ('host_ids' attribute). E.g.:
HTTP POST to  https://example.com/katello/api/v2/host_collections with data {"organization_id": 6, "host_ids": [4, 5], "name": "test_host_collection"}
2. Capture the response. Examine the JSON payload and discover that the "host_ids" attribute is not mentioned.
3. Issue HTTP GET and HTTP PUT requests to previously created host_collection. Check the "host_ids" attribute presence.

Actual results:
'host_ids' attribute is absent in GET/POST/PUT responses.

Expected results:
'host_ids' attribute is present and contains a list of associated hosts ids.

Additional info:
Comment 3 Brad Buckingham 2016-04-19 12:34:05 EDT
Created redmine issue http://projects.theforeman.org/issues/14712 from this bug
Comment 4 Brad Buckingham 2016-04-19 12:44:03 EDT
Upstream katello PR: https://github.com/Katello/katello/pull/5983
Comment 5 Andrii Balakhtar 2016-05-06 10:27:39 EDT
FailedQA in Satellite 6.2.0 GA Snap 10.0
GET and POST now have `host_ids` attribute, but PUT is still missing it.

>>> # GET
... 
>>> entities.HostCollection(id=1).read()
2016-05-06 17:14:46 - nailgun.client - DEBUG - Making HTTP GET request to https://example.com/katello/api/v2/host_collections/1 with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and no data.
2016-05-06 17:14:47 - nailgun.client - DEBUG - Received HTTP 200 response:   {"host_ids":[],"name":"𪦱𥄆䇁𣛤쐥𝗭쵶콹씉秚𩪵𤤯寇𤱂𢪧츜鉿𨛨铽눵𤓦𓇸쨅𣎔𦴻휵","organization_id":130,"max_hosts":null,"description":"kmBvKnosCRqiipfXsmzizZRYblVYPplBFV","total_hosts":0,"unlimited_hosts":true,"created_at":"2016-05-06 03:02:28 UTC","updated_at":"2016-05-06 03:02:28 UTC","id":1,"permissions":{"deletable":true,"editable":true}}

>>> # POST
... 
>>> entities.HostCollection().create()
2016-05-06 17:15:59 - nailgun.client - DEBUG - Making HTTP POST request to https://example.com/katello/api/v2/host_collections with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and data {"organization_id": 1387, "name": "\u60ca\u8d36\u7bc4\ud84a\udce2\ud851\udef8\uac1d\ud800\udf0f\ud843\udc63\ud86d\udeb3\ud843\uddc5\ud86a\udd8c\ud864\udd8f\ud85d\udc79\ubd35\u8cff\ud84f\ude17\ua13a"}.
2016-05-06 17:16:00 - nailgun.client - DEBUG - Received HTTP 200 response:   {"host_ids":[],"name":"惊贶範𢣢𤛸객𐌏𠱣𫚳𠷅𪦌𩆏𧑹봵賿𣸗ꄺ","organization_id":1387,"max_hosts":null,"description":null,"total_hosts":0,"unlimited_hosts":true,"created_at":"2016-05-06 14:16:00 UTC","updated_at":"2016-05-06 14:16:00 UTC","id":100,"permissions":{"deletable":true,"editable":true}}


>>> # PUT
... 
>>> entities.HostCollection(id=1).update()
2016-05-06 17:17:49 - nailgun.client - DEBUG - Making HTTP PUT request to https://example.com/katello/api/v2/host_collections/1 with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and data {"id": 1}.
2016-05-06 17:17:50 - nailgun.client - DEBUG - Received HTTP 200 response:   {"name":"𪦱𥄆䇁𣛤쐥𝗭쵶콹씉秚𩪵𤤯寇𤱂𢪧츜鉿𨛨铽눵𤓦𓇸쨅𣎔𦴻휵","organization_id":130,"max_hosts":null,"description":"kmBvKnosCRqiipfXsmzizZRYblVYPplBFV","total_hosts":0,"unlimited_hosts":true,"created_at":"2016-05-06 03:02:28 UTC","updated_at":"2016-05-06 03:02:28 UTC","id":1,"permissions":{"deletable":true,"editable":true}}
Comment 8 Brad Buckingham 2016-06-21 13:07:57 EDT
Upstream katello PR to address comment 5:
   https://github.com/Katello/katello/pull/6141

Good catch Andrii!
Comment 9 jcallaha 2016-09-07 14:50:06 EDT

GET https://<sat host>.redhat.com/katello/api/host_collections/1
{
  "host_ids": [
    2,
    35,
    26,
    27,
    30,
    31,
    29,
    33,
    32,
    34,
    28
  ],
  "name": "docker",
  "organization_id": 1,
  "max_hosts": null,
  "description": null,
  "total_hosts": 11,
  "unlimited_hosts": true,
  "created_at": "2016-09-01 18:51:36 UTC",
  "updated_at": "2016-09-01 18:51:36 UTC",
  "id": 1,
  "permissions": {
    "deletable": true,
    "editable": true
  }
}

POST https://<sat host>.redhat.com/katello/api/host_collections/ {"organization_id": 1, "host_ids": [4, 5], "name": "test_host_collection"}
{
  "host_ids": [
    4,
    5
  ],
  "name": "test_host_collection",
  "organization_id": 1,
  "max_hosts": null,
  "description": null,
  "total_hosts": 2,
  "unlimited_hosts": true,
  "created_at": "2016-09-07 18:47:21 UTC",
  "updated_at": "2016-09-07 18:47:21 UTC",
  "id": 2,
  "permissions": {
    "deletable": true,
    "editable": true
  }
}

PUT https://<sat host>.redhat.com/katello/api/host_collections/2 {"name": "changed_host_collection"}
{
  "host_ids": [
    4,
    5
  ],
  "name": "changed_host_collection",
  "organization_id": 1,
  "max_hosts": null,
  "description": null,
  "total_hosts": 2,
  "unlimited_hosts": true,
  "created_at": "2016-09-07 18:47:21 UTC",
  "updated_at": "2016-09-07 18:49:18 UTC",
  "id": 2,
  "permissions": {
    "deletable": true,
    "editable": true
  }
}
Comment 11 errata-xmlrpc 2016-09-14 17:00:04 EDT
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-2016:1885

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