Bug #9314
closedpower-state change on vms in aws-compute resource cause 500 server error
Description
I have not been able to get power actions to work through the v2 API on foreman 1.7.1. I am following the API spec here: http://theforeman.org/api/apidoc/v2/hosts/power.html
curl -X PUT --user user:pass -H "Content-Type: application/json" -d '{"power_action":"status","host":{}}' https://foreman/api/v2/hosts/testhost.example.com/power
{
"error": {"message":"undefined method `search_for' for #<Class:0x000000045395e0>"}
}
Full stack trace: http://pastebin.com/dtwx6x2e
The same operation works OK in the UI.
[root@foreman2.cs.ops ~]# foreman-debug
HOSTNAME: foreman2.cs.ops.expertcity.com
OS: redhat
RELEASE: Red Hat Enterprise Linux Server release 6.6 (Santiago)
FOREMAN: 1.7.1
RUBY: ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]
PUPPET:
DENIALS: 0
A debug file has been created: /tmp/foreman-debug-ORzeH.tar.bz2 (18797850 bytes)
You may want to upload the tarball to our public server via rsync. There is a
write only directory (readable only by Foreman core developers) for that. Note
the rsync transmission is UNENCRYPTED:
rsync /tmp/foreman-debug-ORzeH.tar.bz2 rsync://theforeman.org/debug-incoming
Do you want to do this now? [y/N] y
Uploading...
The tarball has been uploaded, please contact us on mailing list or IRC.
Updated by Dominic Cleal about 10 years ago
- Is duplicate of Bug #8812: Pass model type in API base controller added
Updated by Dominic Cleal about 10 years ago
- Status changed from New to Duplicate
Thanks for the report, we have a patch tracked under #8812 which fixes this error that occurs for non-admin users.