Hi,
Maybe it's because I'm not familiar with REST API, but I try to change
hostgroup_id of an host and it doesn't work always.
I'm using Foreman 1.9.0.
Example of what I'm doing first:
curl -k -u admin:password -H "Accept: version=2, application/json" -H "Content-Type:
application/json" -X PUT -d '{ "hostgroup_id":2}' https:
//localhost/api/hosts/2
The result is:
{
"error": {"message":"Resource host not found by id '2'"}
}
After that, I'm trying to change the same host but with hostgroup_id set to
1:
curl -k -u admin:password -H "Accept: version=2, application/json" -H "Content-Type:
application/json" -X PUT -d '{ "hostgroup_id":1}' https:
//localhost/api/hosts/2
The result is:
{"ip":null,"environment_id":1,"environment_name":"production","last_report":
"2015-09-02T20:05:29Z","mac":"08:00:27:3a:0b:5b","realm_id":null,
"realm_name":null,"sp_mac":null,"sp_ip":null,"sp_name":null,"domain_id":1,
"domain_name":"a new name","architecture_id":1,"architecture_name":"x86_64",
"operatingsystem_id":1,"operatingsystem_name":"Ubuntu 14.04.2 LTS",
"subnet_id":null,"subnet_name":null,"sp_subnet_id":null,"ptable_id":null,
"ptable_name":null,"medium_id":null,"medium_name":null,"build":false,
"comment":"test 12321","disk":null,"installed_at":null,"model_id":1,
"model_name":"VirtualBox","hostgroup_id":1,"hostgroup_name":"Provisionne
depuis vagrant-ubuntu-trusty-64.local","owner_id":3,"owner_type":"User",
"enabled":true,"puppet_ca_proxy_id":1,"managed":false,"use_image":null,
"image_file":"","uuid":null,"compute_resource_id":null,
"compute_resource_name":null,"compute_profile_id":null,
"compute_profile_name":null,"capabilities":["build"],"provision_method":
"build","puppet_proxy_id":1,"certname":"testmachine1.local","image_id":null,
"image_name":null,"created_at":"2015-09-02T20:03:46Z","updated_at":
"2015-09-24T14:52:41Z","last_compile":"2015-09-02T20:05:31Z","puppet_status"
:66,"name":"testmachine1.local","id":2,"parameters":[],"interfaces":[{"id":3
,"name":"testmachine1.local","ip":null,"mac":"08:00:27:3a:0b:5b",
"identifier":"eth0","primary":true,"provision":true,"type":"interface"},{
"id":4,"name":"","ip":"192.168.33.11","mac":"08:00:27:ed:1e:ef","identifier"
:"eth1","primary":false,"provision":false,"type":"interface"}],
"puppetclasses":[{"id":6,"name":"ntp","module_name":"ntp"}],"config_groups"
:[],"all_puppetclasses":[{"id":6,"name":"ntp","module_name":"ntp"}]}
It's the same host, the hostgroup with id 1 and 2 exist.
Also, if I try doing this with that
example: Foreman :: Manual,
it returns an error 404 and doesn't work.
Maybe I'm doing something wrong or it's bugged?
Thanks if you have any advice,
Simon