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 1216236 - POST /api/v2/locations returns an incomplete set of attributes
Summary: POST /api/v2/locations returns an incomplete set of attributes
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Tomer Brisker
QA Contact: Tomas Strachota
URL: http://projects.theforeman.org/issues...
Whiteboard:
: 1232855 1235019 (view as bug list)
Depends On:
Blocks: 1234964 1234973 1234999 1235012 1235049 1235378 1235380
TreeView+ depends on / blocked
 
Reported: 2015-04-28 20:24 UTC by jaudet
Modified: 2019-09-26 18:07 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 08:50:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 10356 0 None None None 2016-04-22 15:51:30 UTC
Red Hat Product Errata RHBA-2016:1500 0 normal SHIPPED_LIVE Red Hat Satellite 6.2 Base Libraries 2016-07-27 12:24:38 UTC

Description jaudet 2015-04-28 20:24:26 UTC
Description of problem:
The API returns significantly different information for the following two calls:

* POST /api/v2/locations
* GET /api/v2/locations/:id

This is problematic for two reasons:

* This is inconsistent with how other paths behave, which makes writing client code harder to do.
* Getting authoritative information about a just-created location requires a follow-up API call, which is time-consuming.

Version-Release number of selected component (if applicable):
Tested against Satellite-6.1.0-RHEL-6-20150424.0 and Satellite-6.1.0-RHEL-7-20150424.0.

How reproducible:
100%

Steps to Reproduce:
Here's a sample script:

    >>> from nailgun import entities
    >>> loc_attrs = entities.Location().create_json()
    >>> loc_attrs2 = entities.Location(id=loc_attrs['id']).read_json()
    >>> loc_attrs.keys()  # contents of response to POST call
    [
        u'ancestry',
        u'apply_info_task_id',
        u'created_at',
        u'default_info',
        u'description',
        u'id',
        u'ignore_types',
        u'katello_default',
        u'label',
        u'name',
        u'title',
        u'updated_at',
    ]
    >>> loc_attrs2.keys()  # contents of response to GET call
    [
        u'compute_resources',
        u'config_templates',
        u'created_at',
        u'description',
        u'domains',
        u'environments',
        u'hostgroups',
        u'id',
        u'media',
        u'name',
        u'organizations',
        u'parameters',
        u'select_all_types',
        u'smart_proxies',
        u'subnets',
        u'title',
        u'updated_at',
        u'users',
    ]

Actual results:
The actual results are as shown in the above example.

Expected results:
Both POST and GET requests should return the same information.

Additional info:

Comment 1 RHEL Program Management 2015-04-28 20:33:19 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 jmagen@redhat.com 2015-05-03 12:53:00 UTC
This was a known issue that the response of POST/PUT is just the object and it doesn't use a RABL template (render :json => @object), whereas the GET :id included all the relationships which are in the RABL template show.json.rabl

Comment 4 Bryan Kearney 2015-05-04 13:38:32 UTC
Created redmine issue http://projects.theforeman.org/issues/10356 from this bug

Comment 5 orabin 2015-07-07 08:22:45 UTC
*** Bug 1234964 has been marked as a duplicate of this bug. ***

Comment 6 Bryan Kearney 2015-07-13 12:04:17 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/10356 has been closed
-------------
alon goldboim
Applied in changeset commit:d575926a689fd6abd6f26ee2823ce95eef07dd38.

Comment 7 jcallaha 2015-11-10 16:29:57 UTC
Failed QA in upstream. 

Expected
['ancestry',
 'compute_resources',
 'config_templates',
 'created_at',
 'description',
 'domains',
 'environments',
 'hostgroups',
 'id',
 'media',
 'name',
 'organizations',
 'parameters',
 'provisioning_templates',
 'ptables',
 'select_all_types',
 'smart_proxies',
 'subnets',
 'title',
 'updated_at',
 'users']

Actual
POST https://qe-blade-12.idmqe.lab.eng.bos.redhat.com/api/v2/locations/5
{
    "name": "tester"
}
---------------------------------------
{
  "ancestry": null,
  "created_at": "2015-11-10T15:53:20Z",
  "description": null,
  "id": 5,
  "ignore_types": [
    "ProvisioningTemplate",
    "Hostgroup"
  ],
  "katello_default": false,
  "label": null,
  "name": "tester",
  "title": "tester",
  "updated_at": "2015-11-10T15:53:20Z"
}

  RELEASE: Red Hat Enterprise Linux Server release 7.1 (Maipo)
  FOREMAN: 1.11.0-develop
     RUBY: ruby 2.0.0p598 (2014-11-13) [x86_64-linux]
   PUPPET: 3.8.4

Comment 8 Tomer Brisker 2016-04-12 12:43:11 UTC
This seems to be resolved in current snaps for Sat6.2. Please retest.

Comment 9 Tomas Strachota 2016-05-27 14:07:19 UTC
Verified in snap 13, POST call returned full details.

Comment 11 errata-xmlrpc 2016-07-27 08:50:45 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:1500

Comment 12 Ohad Levy 2016-12-01 08:44:37 UTC
*** Bug 1232855 has been marked as a duplicate of this bug. ***

Comment 13 Ohad Levy 2016-12-01 09:07:11 UTC
*** Bug 1235019 has been marked as a duplicate of this bug. ***


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