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 1211613

Summary: Power action "status" REST API responses from compute resources are not masked to shared values
Product: Red Hat Satellite Reporter: Jan Krocil <jkrocil>
Component: Power & BMCAssignee: Shimon Shtein <sshtein>
Status: CLOSED ERRATA QA Contact: Kedar Bidarkar <kbidarka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.8CC: bkearney, cwelton, egolov, ehelms, kbidarka, lzap
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/10183
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 09:31:23 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: 1341149    
Bug Blocks:    

Description Jan Krocil 2015-04-14 12:31:35 UTC
Description of problem:
Response to "power_action": "state" request towards a baremetal host
{"power":"off"}
Response to "power_action": "state" request towards a vmware VM host:
{"power":"poweredOff"}
^ this is in case the hosts are turned off

I'm not sure if this difference between responses happens with other power_action types as well - this requires further investigation.

Version-Release number of selected component (if applicable):
Upstream foreman 1.7.4-1
(+ most probably downstream satellite 6.0.8)

How reproducible:
Always

Steps to Reproduce:
1. Setup a vmware vsphere compute resource (v5.5 in my case)
2. Provision a VM-based host on that compute resource
3. Provision a baremetal host
4. Run the following request against both hosts to see the difference:
# curl --insecure -X PUT -d '{"power_action": "state"}' -u admin -H "Content-Type:application/json" -H "Accept:application/json"  https://my-foreman.domain.com/api/v2/hosts/my-host.domain.com/power

Actual results:
{"power":"poweredOff"} for VMs, {"power":"off"} for baremetal
or
{"power":"poweredOn"} for VMs, {"power":"on"} for baremetal
etc...

Expected results:
Shared, single type of values for all host types.

Additional info:

Comment 1 RHEL Program Management 2015-04-14 12:43:28 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 4 Bryan Kearney 2015-04-17 19:10:05 UTC
Created redmine issue http://projects.theforeman.org/issues/10183 from this bug

Comment 5 Bryan Kearney 2015-08-25 18:35:02 UTC
Upstream bug component is Power & BMC

Comment 6 Bryan Kearney 2016-03-03 15:02:31 UTC
Upstream bug assigned to sshtein

Comment 7 Bryan Kearney 2016-03-16 14:02:36 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/10183 has been closed
-------------
Shimon Shtein
Applied in changeset commit:1799cee842301e341494748ba4dfd1ecae7589f6.

Comment 8 Kedar Bidarkar 2016-05-30 11:12:33 UTC
[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"}
}
[root@xyz ~]# curl --insecure -X PUT -d '{"power_action": "status"}' -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"}


Currently we face this issue while trying to use the particular API.


TESTED with sat62-snap(GA)-13.1

Comment 9 Shimon Shtein 2016-05-31 11:24:37 UTC
It's a different bug, I have already opened it: https://bugzilla.redhat.com/show_bug.cgi?id=1341149

Comment 14 Kedar Bidarkar 2016-07-08 11:04:31 UTC
Tested the below stuff from a vmware sat6 provisioning a HOST on vcenter55

[abc@xyz ~]# curl --insecure -X PUT -d '{"power_action": "status"}' -u admin:changeme -H "Content-Type:application/json" -H "Accept:application/json"  https://sat6-server.redhat.com/api/v2/hosts/sat6-client.redhat.com/power
{"power":"on"}
[abc@xyz ~]# curl --insecure -X PUT -d '{"power_action": "state"}' -u admin:changeme -H "Content-Type:application/json" -H "Accept:application/json"  https://sat6-server.redhat.com/api/v2/hosts/sat6-client.redhat.com/power
{"power":"on"}

Now we need to check the power state from that of a baremetal box.

Comment 15 Kedar Bidarkar 2016-07-08 11:09:30 UTC
sorry we had to check the power-off status.

[abc@xyz ~]# curl --insecure -X PUT -d '{"power_action": "state"}' -u admin:changeme -H "Content-Type:application/json" -H "Accept:application/json"  https://sat6-server.redhat.com/api/v2/hosts/sat6-client.redhat.com/power
{"power":"off"}
[abc@xyz ~]# curl --insecure -X PUT -d '{"power_action": "status"}' -u admin:changeme -H "Content-Type:application/json" -H "Accept:application/json"  https://sat6-server.redhat.com/api/v2/hosts/sat6-client.redhat.com/power
{"power":"off"}

Tested the stuff from a vmware sat6 provisioning a HOST on vcenter55.
Now we need to check the power state from that of a baremetal box.

Comment 17 errata-xmlrpc 2016-07-27 09:31:23 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:1502