Project

General

Profile

Actions

Bug #13982

closed

API description for creating hosts incorrectly lists "interfaces_attributes"'s "primary" as optional

Added by Pieter Hollants almost 8 years ago. Updated almost 8 years ago.

Status:
Duplicate
Priority:
High
Assignee:
-
Category:
API
Target version:
-
Difficulty:
easy
Triaged:
Fixed in Releases:
Found in Releases:

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":[]}


Related issues 1 (0 open1 closed)

Is duplicate of Foreman - Bug #14239: Creating a host via API fails with cryptic error when no primary interface is set explicitlyClosedTom Caspy03/16/2016Actions
Actions #1

Updated by Dominic Cleal almost 8 years ago

  • Is duplicate of Bug #14239: Creating a host via API fails with cryptic error when no primary interface is set explicitly added
Actions #2

Updated by Dominic Cleal almost 8 years ago

  • Status changed from New to Duplicate

I think #14239 has fixed this in a different way, by automatically setting a primary interface if none is specified. The attribute remains optional. Thanks for the report.

Actions

Also available in: Atom PDF