Is there a way to update host location via hammer?
Problem:
Not able to update a host location via hammer
hammer host update --id=14 --location-id=75
Could not update the host:
Resource host not found by id ‘14’
hammer host info --id=14
Id: 14
Name: yjtacwvhumr.yehlaejeqq
…
hammer location info --id=75
Id: 75
Title: lBbFIVuava
Name: lBbFIVuava
…
via debug we can see:
[ INFO 2018-12-14T12:31:38 API] Server: XXXXX
[ INFO 2018-12-14T12:31:38 API] PUT /api/hosts/14
[DEBUG 2018-12-14T12:31:38 API] Params: {
“location_id” => 75,
“host” => {
“location_id” => 75,
“puppetclass_ids” => ,
“compute_attributes” => {},
“content_facet_attributes” => {},
“subscription_facet_attributes” => {}
}
}
[DEBUG 2018-12-14T12:31:38 API] Headers: {}
[DEBUG 2018-12-14T12:31:38 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[ERROR 2018-12-14T12:31:38 API] 404 Not Found
[DEBUG 2018-12-14T12:31:38 API] {
“error” => {
“message” => “Resource host not found by id ‘14’”
}
Eg seems hammer try to filter hosts by the supplied location-id
Other relevant data:
For the moment we are able to update the location via API
Usage Scenario:
When subscribing a host via subscription-manager, the host is automatically subscribed to Default Location, but it’s intended to be used by a user that has access to other location (user location), and we want to assign the user location to that host.