Project

General

Profile

Actions

Bug #34967

open

Setting interface identifier when creating host via api

Added by Andrew Thomson almost 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

From my read of the api documentation, I understand I should be able to set the interface identifier when creating a new host??

I'm using the following JSON, and everything else works great. Adding a bare metal system hence the null compute_resource_id.

{
  "host": {
    "name": "tokyo",
    "organization_id": 1,
    "location_id": 20,
    "hostgroup_id": 7,
    "compute_resource_id": null,
    "mac": "00:0f:a3:8d:9b:ec",
    "architecture_id": 1,
    "operatingsystem_id": 12,
    "medium_id": 13,
    "ptable_id": 206,
    "pxe_loader": "PXELinux BIOS",
    "root_pass": "xxxxxxx",
    "domain_id": 1,
    "build": 1,
    "enabled": 1,
    "comment": "Added via API",
    "subnet_id": 27,
    "interfaces": [
      {
        "name": "tokyo.prv.aaa.com",
        "type": "interface",
        "identifier": "eth0",
        "mac": "00:0f:a3:8d:9b:ec",
        "subnet_id": 27,
        "domain_id": 1,
        "managed": 1,
        "primary": 1,
        "provision": 1
      }
    ]
  }
}

Checking the Foreman logs, the following message is displayed.

2022-05-25T19:50:27 [D|app|66d7d551] Unpermitted parameter: :interface_names

I started having a poke around the hosts controller but my RoR is a little rusty! ;)

Once the host is created, I can go back and add the identifier to the interface just fine (at least in the gui).

No data to display

Actions

Also available in: Atom PDF