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 1341149

Summary: No permissions for power, puppetrun e.t.c in API
Product: Red Hat Satellite Reporter: Shimon Shtein <sshtein>
Component: HostsAssignee: Shimon Shtein <sshtein>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, bkearney, cwelton, egolov, inecas, lzap, mhulan, riehecky, rplevka, sauchter
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-katello-3.0.0.53-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:42:05 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:    
Bug Blocks: 1211376, 1211613, 1316897    

Description Shimon Shtein 2016-05-31 11:23:25 UTC
Description of problem:

Host's special actions will fail with "Unknown permission" exception

Example:

[root@xyz ~]# curl --insecure -X PUT -d '{"power_action": "state"}' -u admin:changeme -H "Content-Type:application/json" -H "Accept:application/json"  https://abc.redhat.com/api/v2/hosts/abc1.redhat.com/power 
{
  "error": {"message":"ERF42-5531 [Foreman::Exception]: unknown permission for api/v2/hosts#power"}
}

Additional info:

Katello is redefining #action_permission method in katello/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb which means that the original host's method is not called.
In foreman this method defines a lot of special actions.

Comment 1 Shimon Shtein 2016-05-31 11:28:42 UTC
Created redmine issue http://projects.theforeman.org/issues/15236 from this bug

Comment 3 Bryan Kearney 2016-05-31 18:17:08 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/15236 has been closed

Comment 7 Ivan Necas 2016-06-03 09:38:47 UTC
*** Bug 1342040 has been marked as a duplicate of this bug. ***

Comment 9 Ivan Necas 2016-06-03 09:43:23 UTC
I can confirm the path addresses issues in 1342040

Comment 11 Roman Plevka 2016-06-30 11:57:42 UTC
VERIFIED
on sat6.2.0 snap18.1

<pre>
# curl -ku admin:changeme -X PUT -H 'Content-Type:application/json' -d '{"power_action": "off"}' https://$(hostname)/api/v2/hosts/3/power/
{"power":true}
[root ~]# curl -ku admin:changeme -X PUT -H 'Content-Type:application/json' -d '{"power_action": "state"}' https://$(hostname)/api/v2/hosts/3/power/
{"power":"off"}
[root ~]# curl -ku admin:changeme -X PUT -H 'Content-Type:application/json' -d '{"power_action": "on"}' https://$(hostname)/api/v2/hosts/3/power/
{"power":true}
[root ~]# curl -ku admin:changeme -X PUT -H 'Content-Type:application/json' -d '{"power_action": "state"}' https://$(hostname)/api/v2/hosts/3/power/
{"power":"running"}
</pre>

Comment 13 Bryan Kearney 2016-07-27 11:42:05 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:1501