Description of problem: Executing `hammer host stop --id <ID>` returns "ERF42-5227 [Foreman::Exception]: unknown parent permission for api/v2/hosts#power"
Version-Release number of selected component (if applicable): 6.4
How reproducible: Always
Steps to Reproduce:
1. Use VMware ESXi 6.7 as a compute resource
2. Create a VM as a managed host.
3. Execute `hammer host stop --id <ID>`
Actual results: ERF42-5227 [Foreman::Exception]: unknown parent permission for api/v2/hosts#power and the VM remains powered on.
Expected results: The VM is powered off gracefully.
Created redmine issue https://projects.theforeman.org/issues/25745 from this bug
This happens for any compute resource. The reason is that hammer has default org set, so it uses /organization/x/host/y route and we don't have mapping between power action permission and parent resource permission. The fix is to add mapping to check "view_organizations" on org x for such call. Workaround is to use admin account or don't specify org id at all (remove hammer defaults)
Upstream bug assigned to email@example.com
I wanted to add that we are executing the hammer commands as the default Satellite admin, but we do have a default org set.
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25745 has been resolved.