Bug #20212

POST /api/v2/hosts does not return `parameters` attribute.

Added by Shimon Shtein 4 months ago. Updated 4 months ago.

Status:Closed
Priority:Normal
Assigned To:Shimon Shtein
Category:Inventory
Target version:-
Difficulty: Bugzilla link:1449749
Found in release: Pull request:https://github.com/theforeman/foreman/pull/4645
Story points-
Velocity based estimate-
Release1.15.3Release relationshipAuto

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1449749

Description of problem:
On Sat 6.2 and earlier POST /api/v2/hosts sends `host_parameters_attributes` as data and returns all the attributes for created host, including `parameters`. Now it does not return this field at all and additional GET request is needed to obtain `parameters`.

Example using nailgun tool:
  1. Send POST request with defined `host_parameters_attributes`
    In [9]: host = entities.Host(server_config, host_parameters_attributes=[{'name': 'abc', 'value': 'xyz'}]).create_json(create_missing=True)
  1. Check that `parameters is missing in response
    In [10]: 'parameters' in host
    Out10: False
  1. Send GET request and check that parameters was returned
    In [11]: 'parameters' in entities.Host(server_config, id=host['id']).read_json()
    Out11: True

In [12]: entities.Host(server_config, id=host['id']).read_json()['parameters']
Out12:
[{u'created_at': u'2017-05-10 14:48:02 UTC',
u'id': 9,
u'name': u'abc',
u'priority': 70,
u'updated_at': u'2017-05-10 14:48:02 UTC',
u'value': u'xyz'}]

Version-Release number of selected component (if applicable):
Satellite Downstream nightly / 6.3:
  • satellite-6.3.0-11.1.beta.el7sat.noarch
  • foreman-1.15.0-0.develop.201703271956git40dd32b.el7sat.noarch

How reproducible:
Always

Steps to Reproduce:
1. Create a host by issuing a POST request to /api/v2/hosts
2. Check its response
3.

Actual results:
`parameters` is missing

Expected results:
`parameters` should be returned

Additional info:


Related issues

Related to Foreman - Feature #16114: Expose host parameters to GET /api/hosts Closed 08/15/2016

Associated revisions

Revision 76222035
Added by Shimon Shtein 4 months ago

Fixes #20212 - create and update host actions now showing params

Revision 12b88c1c
Added by Shimon Shtein 2 months ago

Fixes #20212 - create and update host actions now showing params

(cherry picked from commit 76222035de2cdbc6397d91b7aa1ed15f098316eb)

History

#1 Updated by Shimon Shtein 4 months ago

  • Related to Feature #16114: Expose host parameters to GET /api/hosts added

#2 Updated by The Foreman Bot 4 months ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Shimon Shtein
  • Pull request https://github.com/theforeman/foreman/pull/4645 added

#3 Updated by Daniel Lobato Garcia 4 months ago

  • Release set to 1.15.3

#4 Updated by Daniel Lobato Garcia 4 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF