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 1503704 - hammer host-collection list requires organization parameter with host-id provided
Summary: hammer host-collection list requires organization parameter with host-id prov...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Andrew Kofink
QA Contact: Nikhil Kathole
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-18 14:54 UTC by Roman Plevka
Modified: 2019-08-12 14:05 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 17:30:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 21435 0 None None None 2017-10-23 17:15:07 UTC

Description Roman Plevka 2017-10-18 14:54:45 UTC
Description of problem:


[root@cisco-b420m3-01 ~]# hammer host-collection list --host-id 2
Error: Could not find organization, please set one of options --organization, --organization-label, --organization-id.
[root@cisco-b420m3-01 ~]# hammer host-collection list --host-id 3 --organization-id 1
Couldn't find Host::Managed with 'id'=3 [WHERE "hosts"."type" IN ('Host::Managed')]
 
This should not happen, since host-id is unique, so satellite should be able to figure out the appt organization.
Also, this is a regression since last snap (6.3.0-19)



Version-Release number of selected component (if applicable):
6.3.0-20

How reproducible:


Steps to Reproduce:
1. create a host collection and create & add a host into it
2. try to list host collection by specifying its member id (host-id)

Actual results:
organization parameter required

Expected results:
should be able to list the HC

Additional info:

Comment 2 Andrew Kofink 2017-10-20 15:46:03 UTC
This is caused by BZ #1480508

Comment 3 Roman Plevka 2017-10-23 12:07:44 UTC
what is the expected behavior?
as in 6.3.0, the org paramaeter is now required even for a simple GET /host_collections call.
From the BZ #1480508 i can see, this should not be required.
Will the fix for this BZ address this issue as well?

thanks

Comment 4 Andrew Kofink 2017-10-23 12:50:11 UTC
organization_id should not be required in host_collections#index. I will investigate if BZ #1480508 is reproducible after making the change.

Comment 5 Andrew Kofink 2017-10-23 17:15:05 UTC
Created redmine issue http://projects.theforeman.org/issues/21435 from this bug

Comment 6 Satellite Program 2017-10-25 20:17:54 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/21435 has been resolved.

Comment 7 Nikhil Kathole 2017-10-31 11:27:55 UTC
VERIFIED

Version Tested:
Satellite-6.3 Snap 22

steps:

# hammer host-collection list
---|------------------------------|-------|------------
ID | NAME                         | LIMIT | DESCRIPTION
---|------------------------------|-------|------------
3  | hostcollectionin another org | None  |
2  | host_collection_test1        | None  |
1  | RHEL 7 Host collection       | None  |
---|------------------------------|-------|------------

# hammer host-collection list --host-id 15
---|------------------------|-------|------------
ID | NAME                   | LIMIT | DESCRIPTION
---|------------------------|-------|------------
1  | RHEL 7 Host collection | None  |
---|------------------------|-------|------------

# hammer host-collection list --organization-id 1
---|------------------------|-------|------------
ID | NAME                   | LIMIT | DESCRIPTION
---|------------------------|-------|------------
2  | host_collection_test1  | None  |
1  | RHEL 7 Host collection | None  |
---|------------------------|-------|------------

# hammer host-collection list --organization-id 1 --host-id 15
---|------------------------|-------|------------
ID | NAME                   | LIMIT | DESCRIPTION
---|------------------------|-------|------------
1  | RHEL 7 Host collection | None  |
---|------------------------|-------|------------

Also verified BZ #1480508 ,

# curl -s -X GET -k -u admin:<passwd> 'https://<satellite>/katello/api/v2/host_collections'| json_reformat
{
    "total": 3,
    "subtotal": 3,
    "page": 1,
    "per_page": 20,
    "error": null,
    "search": null,
    "sort": {
        "by": "name",
        "order": "asc"
    },
    "results": [
        {
            "name": "hostcollectionin another org",
            "organization_id": 8,
            "max_hosts": null,
            "description": null,
            "total_hosts": 0,
            "unlimited_hosts": true,
            "created_at": "2017-10-31 06:53:59 UTC",
            "updated_at": "2017-10-31 06:53:59 UTC",
            "id": 3,
            "permissions": {
                "deletable": true,
                "editable": true
            }
        },
        {
            "name": "host_collection_test1",
            "organization_id": 1,
            "max_hosts": null,
            "description": null,
            "total_hosts": 0,
            "unlimited_hosts": true,
            "created_at": "2017-10-31 06:52:20 UTC",
            "updated_at": "2017-10-31 06:52:20 UTC",
            "id": 2,
            "permissions": {
                "deletable": true,
                "editable": true
            }
        },
        {
            "name": "RHEL 7 Host collection",
            "organization_id": 1,
            "max_hosts": null,
            "description": null,
            "total_hosts": 1,
            "unlimited_hosts": true,
            "created_at": "2017-10-31 06:51:49 UTC",
            "updated_at": "2017-10-31 06:51:49 UTC",
            "id": 1,
            "permissions": {
                "deletable": true,
                "editable": true
            }
        }
    ]
}

# curl -s -X GET -k -u admin:<passwd> 'https://<satellite>/katello/api/v2/host_collections?organization_id=1'| json_reformat
{
    "total": 2,
    "subtotal": 2,
    "page": 1,
    "per_page": 20,
    "error": null,
    "search": null,
    "sort": {
        "by": "name",
        "order": "asc"
    },
    "results": [
        {
            "name": "host_collection_test1",
            "organization_id": 1,
            "max_hosts": null,
            "description": null,
            "total_hosts": 0,
            "unlimited_hosts": true,
            "created_at": "2017-10-31 06:52:20 UTC",
            "updated_at": "2017-10-31 06:52:20 UTC",
            "id": 2,
            "permissions": {
                "deletable": true,
                "editable": true
            }
        },
        {
            "name": "RHEL 7 Host collection",
            "organization_id": 1,
            "max_hosts": null,
            "description": null,
            "total_hosts": 1,
            "unlimited_hosts": true,
            "created_at": "2017-10-31 06:51:49 UTC",
            "updated_at": "2017-10-31 06:51:49 UTC",
            "id": 1,
            "permissions": {
                "deletable": true,
                "editable": true
            }
        }
    ]
}

Comment 8 Bryan Kearney 2018-02-21 17:30:57 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/RHSA-2018:0336


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