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 1408445

Summary: POST /api/v2/hosts and GET /api/v2/hosts/:id name the same attributes differently
Product: Red Hat Satellite Reporter: Stanislav Tkachenko <stkachen>
Component: ParametersAssignee: Ivan Necas <inecas>
Status: CLOSED WONTFIX QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: bkearney, inecas, jaudet, katello-qa-list, mhulan, ohadlevy, orabin, tbrisker
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1235019 Environment:
Last Closed: 2018-08-02 20:58:41 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: 1235019    
Bug Blocks:    

Description Stanislav Tkachenko 2016-12-23 12:15:49 UTC
Cloned bug was closed as duplicate however it was only partially fixed. `puppetclass` parameter now has same name for both POST and GET requests, while `host_parameters_attributes` still used for POST and `parameters` for GET.

Below is modified description of cloned bug to describe current situation.

+++ This bug was initially created as a clone of Bug #1235019 +++

Description of problem:
When issuing a POST request to /api/v2/hosts, you can provide the following attributes, among others:

* host_parameters_attributes

When issuing a GET request to /api/v2/hosts/:id, the following attributes are returned:

* parameters

This mis-match between attribute names when issuing POST and GET requests is troublesome and forces API clients to write up manual hacks. POST and GET requests should return identically named attributes.

POST request, sending `parameters` as data:
> 2016-12-23 13:59:38 - nailgun.client - DEBUG - Making HTTP POST request to https://sat6.com/api/v2/hosts with ... and data {... "parameters": [{"name": "value"}], ...}.

Response, `parameters` is empty and `host_parameters_attributes` is missing:
> 2016-12-23 13:59:39 - nailgun.client - DEBUG - Received HTTP 201 response: {...,"parameters":[],"all_parameters":[], ... }

GET request, `parameters` is empty and `host_parameters_attributes` is missing:
> 2016-12-23 14:05:53 - nailgun.client - DEBUG - Making HTTP GET request to https://sat6.com/api/v2/hosts/37 with ... and no data.
> 2016-12-23 14:05:54 - nailgun.client - DEBUG - Received HTTP 200 response: {...,"parameters":[],"all_parameters":[], ...}

POST request, sending `host_parameters_attributes` as data:
> 2016-12-23 14:08:02 - nailgun.client - DEBUG - Making HTTP POST request to https://sat6.com/api/v2/hosts with ... and data {" "host_parameters_attributes": [{"name": "value"}], ...}.

Response, `parameters` not empty:
> 2016-12-23 14:08:04 - nailgun.client - DEBUG - Received HTTP 201 response: {..., "parameters":[{"id":6,"name":"value","value":null}],"all_parameters":[{"id":6,"name":"value","value":null}], ...}


Version-Release number of selected component (if applicable):
Satellite 6.3 Snap 8 / Foreman 1.13.2.2-1

How reproducible:
100%

Steps to Reproduce:
1. Create a host by issuing a POST request to /api/v2/hosts.
2. Read a host by issuing a GET request to /api/v2/hosts/:id.
3. Discover that the POST request accepts differently named parameters than the GET request.

Actual results:
POST and GET work with differently named parameters.

Expected results:
POST and GET work with identically named parameters.

Additional info:


--- Additional comment from alon on 2015-07-14 08:20:30 EDT ---

Fixed in http://projects.theforeman.org/issues/10356

Comment 2 Bryan Kearney 2018-08-02 20:58:41 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the forseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.