Bug 1257255

Summary: GET /api/v2/discovery_rules/:id does not return all attributes
Product: Red Hat Satellite Reporter: jaudet
Component: APIAssignee: Lukas Zapletal <lzap>
Status: CLOSED WONTFIX QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: bbuckingham, bkearney
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-11 19:31:34 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:

Description jaudet 2015-08-26 15:08:37 UTC
Description of problem:
An HTTP GET /api/v2/discovery_rules/:id returns a hash of information about a discovery rule. The "max_count" key is missing from this hash.

Version-Release number of selected component (if applicable):
Tested against Satellite-6.1.1-RHEL-7-20150825.2. Foreman-debug attached.

How reproducible:
Always.

Steps to Reproduce:
1. Make an HTTP GET call to /api/v2/discovery_rules/:id
2. Look at the keys of the JSON response payload.

Actual results:

These are the keys in the returned hash:

    [
        u'enabled',
        u'hostgroup_id',
        u'hostgroup_name',
        u'hostname',
        u'hosts',
        u'hosts_limit',
        u'id',
        u'name',
        u'priority',
        u'search',
    ]

Expected results:
Same as above, but with the "max_count" key present.

Additional info:
Here's a script showing exactly what's returned in response to POST and GET requests and the differences between the two.

    >>> from nailgun.entities import DiscoveryRule
    >>> attrs1 = DiscoveryRule().create_json(create_missing=True)
    >>> attrs2 = DiscoveryRule(id=attrs1['id']).read_json()
    >>> attrs1.keys()
    [
        u'created_at',
        u'enabled',
        u'hostgroup_id',
        u'hostname',
        u'id',
        u'max_count',
        u'name',
        u'priority',
        u'search',
        u'updated_at',
    ]
    >>> attrs2.keys()
    [
        u'enabled',
        u'hostgroup_id',
        u'hostgroup_name',
        u'hostname',
        u'hosts',
        u'hosts_limit',
        u'id',
        u'name',
        u'priority',
        u'search',
    ]
    >>> set(attrs1.keys()) - set(attrs2.keys())  # In POST response, but not GET.
    set([u'created_at', u'updated_at', u'max_count'])
    >>> set(attrs2.keys()) - set(attrs1.keys())  # In GET response, but not POST.
    set([u'hostgroup_name', u'hosts', u'hosts_limit'])

Comment 2 Bryan Kearney 2017-01-11 19:31:34 UTC
This is an older bug which I do not envision being fixed in the near term. I am closing this out. If you believe doing so is an issue, please feel free to re-open and provide additional business information. Thank you.