Project

General

Profile

Bug #31311

not possible to update interfaces in POST /api/hosts/:host_id

Added by Evgeni Golov 11 months ago. Updated 11 months ago.

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

Description

Ohai,

PUT /api/hosts/:host_id allows to provide interface_attributes, but id is not one of the accepted attributes, so it's not possible to update an existing interface using that API (validation fails if one tries, "duplicate identifier"). The same works fine using the dedicated /api/interfaces/:host_id endpoint

Related issues

Related to Foreman - Tracker #27680: API bugs that need workarounds in foreman-ansible-modulesNew

Associated revisions

Revision a3f030f1 (diff)
Added by Evgeni Golov 11 months ago

Fixes #31311 - add `id` to apidoc of interfaces_attributes

the hosts controller accepts `id` already, but without it being exposed
in the apidoc, api clients don't know that it can be set

History

#1 Updated by Evgeni Golov 11 months ago

  • Related to Tracker #27680: API bugs that need workarounds in foreman-ansible-modules added

#2 Updated by The Foreman Bot 11 months ago

  • Assignee set to Evgeni Golov
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/8137 added

#3 Updated by Evgeni Golov 11 months ago

As my description seems to be not top notch:

  • The API accepts the `id` parameter if it's sent, and then the interface is updated properly
  • The API rejects PUTs without `id` which try to refer to an existing interface
  • API clients that validate their requests against the apidoc before sending it, will drop the `id` param.

#4 Updated by The Foreman Bot 11 months ago

  • Fixed in Releases 2.4.0 added

#5 Updated by Evgeni Golov 11 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF