Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1325989 - GET/POST/PUT /api/v2/host_collections/ do not return 'host_ids' attribute
Summary: GET/POST/PUT /api/v2/host_collections/ do not return 'host_ids' attribute
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Brad Buckingham
QA Contact: jcallaha
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-11 14:14 UTC by Andrii Balakhtar
Modified: 2021-07-22 07:38 UTC (History)
4 users (show)

Fixed In Version: rubygem-katello-3.0.0.74-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-14 21:00:04 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 14712 0 None None None 2016-04-22 16:08:11 UTC
Foreman Issue Tracker 15486 0 None None None 2016-06-21 16:59:17 UTC
Red Hat Product Errata RHBA-2016:1885 0 normal SHIPPED_LIVE Satellite 6.2.2 bug fix update 2016-09-15 00:57:56 UTC

Description Andrii Balakhtar 2016-04-11 14:14:16 UTC
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 16:34:05 UTC
Created redmine issue http://projects.theforeman.org/issues/14712 from this bug

Comment 4 Brad Buckingham 2016-04-19 16:44:03 UTC
Upstream katello PR: https://github.com/Katello/katello/pull/5983

Comment 5 Andrii Balakhtar 2016-05-06 14:27:39 UTC
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 17:07:57 UTC
Upstream katello PR to address comment 5:
   https://github.com/Katello/katello/pull/6141

Good catch Andrii!

Comment 9 jcallaha 2016-09-07 18:50:06 UTC

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 21:00:04 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-2016:1885


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