Bug 1331875 - undefined method `id' for nil:NilClass in katello/api/v2/host_collections
Summary: undefined method `id' for nil:NilClass in katello/api/v2/host_collections
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: Unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Andrew Kofink
QA Contact: Bruno Rocha
URL: http://projects.theforeman.org/issues...
Whiteboard:
: 1321053 1370442 1392755 (view as bug list)
Depends On:
Blocks: 1415679
TreeView+ depends on / blocked
 
Reported: 2016-04-29 21:22 UTC by Andrew Kofink
Modified: 2021-09-09 11:50 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1415679 (view as bug list)
Environment:
Last Closed: 2018-02-21 16:54:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 14889 0 'Normal' 'Closed' 'undefined method `id'' for nil:NilClass in katello/api/v2/host_collections' 2019-11-25 09:51:35 UTC
Red Hat Knowledge Base (Solution) 3440331 0 None None None 2018-05-11 04:49:11 UTC

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


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