Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1331875

Summary: undefined method `id' for nil:NilClass in katello/api/v2/host_collections
Product: Red Hat Satellite Reporter: Andrew Kofink <akofink>
Component: APIAssignee: Andrew Kofink <akofink>
Status: CLOSED ERRATA QA Contact: Bruno Rocha <rochacbruno>
Severity: medium Docs Contact:
Priority: unspecified    
Version: UnspecifiedCC: aagrawal, ajambhul, anerurka, bbuckingham, bkearney, gapatil, jcallaha, mmccune, omaciel, oshtaier, pmoravec, rochacbruno, xdmoon
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/14889
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1415679 (view as bug list) Environment:
Last Closed: 2018-02-21 16:54:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1415679    

Description Andrew Kofink 2016-04-29 21:22:05 UTC
Description of problem: When requesting katello/api/v2/host_collections with no parameters, "id" is called on nil.


Version-Release number of selected component (if applicable): 1.12-develop


How reproducible: Always


Steps to Reproduce:
1. Visit http://localhost:3000/katello/api/v2/host_collections

Actual results:
undefined method `id' for nil:NilClass


Expected results:
JSON result of all host_collection objects across all organizations

Additional info:
This is not a bug in Satellite 6.1 or 6.2.

Comment 1 Andrew Kofink 2016-04-29 21:23:05 UTC
Created redmine issue http://projects.theforeman.org/issues/14889 from this bug

Comment 2 Andrew Kofink 2016-05-02 13:59:15 UTC
*** Bug 1321053 has been marked as a duplicate of this bug. ***

Comment 3 Bryan Kearney 2016-05-02 20:17:24 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/14889 has been closed

Comment 5 Brad Buckingham 2016-08-29 14:49:42 UTC
*** Bug 1370442 has been marked as a duplicate of this bug. ***

Comment 10 Brad Buckingham 2016-11-08 19:58:18 UTC
Note: the same error can be observed by executing the following via hammer-cli:

hammer -u admin -p mypassword host-collection list

Comment 11 Brad Buckingham 2016-11-08 19:58:34 UTC
*** Bug 1392755 has been marked as a duplicate of this bug. ***

Comment 12 Bruno Rocha 2016-11-17 17:15:20 UTC
VErified in:

satellite-6.3.0-6.1.beta.el7sat.noarch - RHEL7

Conclusion:

Works properly.

[brocha@localhost ~]$ curl --insecure --user admin:xxxx "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET /katello/api/v2/host_collections | python -m json.tool

{
    "error": null,
    "page": 1,
    "per_page": 9999,
    "results": [
        {
            "created_at": "2016-11-10 19:59:39 UTC",
            "description": null,
            "id": 1,
            "max_hosts": null,
            "name": "foocol",
            "organization_id": 33,
            "permissions": {
                "deletable": true,
                "editable": true
            },
            "total_hosts": 2,
            "unlimited_hosts": true,
            "updated_at": "2016-11-10 19:59:39 UTC"
        }
    ],
    "search": null,
    "sort": {
        "by": null,
        "order": null
    },
    "subtotal": 1,
    "total": 1
}

Comment 13 Satellite Program 2018-02-21 16:54:17 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