Bug 1328873

Summary: Apidoc contains wrong documentation for puppet classes key in host v2 API
Product: Red Hat Satellite Reporter: Kenny Tordeurs <ktordeur>
Component: APIAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Kavita <kgaikwad>
Severity: high Docs Contact:
Priority: high    
Version: 6.1.8CC: bkearney, jcallaha, kgaikwad, ktordeur, mhulan, satellite6-bugs, swadeley
Target Milestone: UnspecifiedKeywords: Reopened
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:49:54 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:
Attachments:
Description Flags
apidoc output in 6.2
none
apidoc output in 6.3 none

Description Kenny Tordeurs 2016-04-20 13:02:55 UTC
Description of problem:
Unable to add a puppet module to a host via REST API

Version-Release number of selected component (if applicable):
Satellite 6.1.8

How reproducible:
100%

Steps to Reproduce:
1. List puppet modules from a host:
# curl -X GET -s -k -u admin:password https://satellite-fqdn/api/v2/hosts/client_host/puppetclasses

2. Add puppet module to a host:
# curl -X PUT -s -k -u admin:password https://satellite-fqdn/api/v2/hosts/client_host -H "Content-Type: application/json" -d '{"puppet_class_ids":["100"]}'

Gets a 200 response ok.

3. Verify the puppet modules for the client_host


Actual results:
The puppet module has not been added to the content host


Expected results:
The puppet module to be added to the host

Additional info:

Additional findings:

I was using the documentation at <satelliteserver>/apidoc/v2/hosts/update.html which states using PUT to the host and puppet_class_ids as payload

Using the "regular"/v1/ (/apidoc/v1) version its API like is:

https://satellite-fqdn/api/hosts 
and adding this payload:
{"puppetclass_ids":["114"]}

It works

Notice the difference in the payload (puppetclass_ids vs puppet_class_ids) and the url in use

Comment 4 Kenny Tordeurs 2016-07-01 07:19:50 UTC
Hi,

Any news on this?

Thanks

Comment 5 Bryan Kearney 2016-09-12 16:27:42 UTC
This bug is not yet scheduled for a release.

Comment 6 Marek Hulan 2016-12-02 11:10:41 UTC
I verified that this works through on 6.2.5 and 6.3. I think this also worked with 6.1, the issue is that you pass "puppet_class_ids" instead of "puppetclass_ids". Unknown attributes are ignored. Closing as not a bug.

Comment 9 Marek Hulan 2016-12-06 02:12:12 UTC
Created attachment 1228246 [details]
apidoc output in 6.2

Comment 11 Kenny Tordeurs 2016-12-06 08:19:52 UTC
Yes, API doc for Satellite 6.2 is correct, never saw this issue on Satellite 6.2.x only on 6.1.x API docs.

I've checked on a Sat 6.1.9 and 6.1.10 and there the API doc is incorrect even after running `foreman-rake apipie:cache`

Can we correct this for Satellite 6.1.x ?

Comment 12 Stephen Wadeley 2016-12-06 10:16:57 UTC
Hello


This bug is for the builtin API reference doc, not the API Guide.

We need to change the component back to API as "Docs API Guide" means the guide on the customer portal.


Thank you

Comment 13 Stephen Wadeley 2016-12-06 10:25:11 UTC
see also

Bug 1235041 - PUT /api/v2/hosts/:id returns HTTP 500 when updating "capabilities" or "puppet_class_ids"

Comment 17 Bryan Kearney 2017-03-27 16:22:22 UTC
We are not going to backport this 6.1. I will leave the bug on 6.3 for verification.

Comment 18 Kavita 2017-08-04 09:39:28 UTC
Created attachment 1308971 [details]
apidoc output in 6.3

puppetclass_ids work well and it is fixed in build-in API doc reference of
sat6.3. Instead of "puppet_class_ids", it is showing "puppetclass_ids" in API doc.

<satelliteserver>/apidoc/v2/hosts/update.html which showing puppetclass_ids not puppet_class_ids. 

Verified.
Version Tested: Satellite-6.3 Snap 9.
web-ui screen-shots attached.


** RPM package versions:

satellite-6.3.0-16.0.beta.el7sat.noarch
foreman-1.15.2-1.el7sat.noarch
tfm-rubygem-hammer_cli-0.10.2-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman-0.10.2-1.el7sat.noarch

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