Bug #13982
closedAPI description for creating hosts incorrectly lists "interfaces_attributes"'s "primary" as optional
Description
http://theforeman.org/api/1.10/apidoc/v2/hosts/create.html says:
host[interfaces_attributes][primary]
optional , nil allowed
The "optional" flag seems to be wrong:
$ curl -s -H "Content-Type: application/json" k -u admin:secret -d '{"host":{"hostgroup_id": "1", "name": "test", "environment_id":"1", "interfaces_attributes":{"0":{"ip":"192.168.100.5","mac":"00:11:22:33:44:55","type":"interface","identifier":"eth0"}}}}' http://foreman.test.foo/api/hosts {
"error": {"id":null,"errors":{"interfaces.mac":["can't be blank"]},"full_messages":["Mac can't be blank"]}
}
$ curl -s -H "Content-Type: application/json" k -u admin:secret -d '{"host":{"hostgroup_id": "1", "name": "test", "environment_id":"1", "interfaces_attributes":{"0":{"ip":"192.168.100.5","mac":"00:11:22:33:44:55","primary":"true"}}}}' http://foreman.test.foo/api/hosts {"ip":"192.168.100.5", ... ,"all_puppetclasses":[]}