Bug #13704
closed
Error when updating host location by name through API
Added by David Barbion over 8 years ago.
Updated about 6 years ago.
Description
Hi,
I would like to update a host location by providing "location_name" by it results in error: Here is a simple curl command I use:
$ curl -s -X PUT -H "Content-Type: application/json" -k -u hammer:hammer \
-d '{"host": { "location_name": "mag003"}}' \
https://foreman.example.com/api/hosts/host.example.com
{
"error": {"message":"undefined method `id' for nil:NilClass"}
}
When I provide "location_id", it works.
Files
This problem occurs when providing an inexistent location.
In my case, it works if I provide full location_name:
curl -s -X PUT -H "Content-Type: application/json" -k -u hammer:hammer \
-d '{"host": { "location_name": "Full/path/to/mag003"}}' \
https://foreman.example.com/api/hosts/host.example.com
- Status changed from New to Ready For Testing
- Assignee set to Shlomi Zadok
- Pull request https://github.com/theforeman/foreman/pull/3851 added
- Target version set to 1.5.3
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
- Translation missing: en.field_release set to 190
- Related to Bug #16813: Confusing error message on association not found error added
- Bugzilla link set to 1379006
Also available in: Atom
PDF