Bug #12566
closedNew Host API changed host_parameters_attributes behavior
Description
This API call used to work:
{ "host": { "name": "test", "mac": "AA:BB:CC:DD:EE:F1", "organization_id": 3, "location_id": 2, "hostgroup_id": 7, "host_parameters_attributes": [ { "name": "compute_resource_id", "value": "1", "_destroy": "false", "nested": "false" } ] } }
Now it fails with ActiveRecord::UnknownAttributeError: unknown attribute: nested. Regression, looks like some nesting changes broke this, since oVirt uses this API (via discovery), we should consider a portability fix.
Updated by Lukas Zapletal almost 9 years ago
- Related to Bug #12516: PUT request for discovered_hosts/[id] fails with "unknown attribute: nested" added
Updated by Dominic Cleal almost 9 years ago
- Status changed from New to Feedback
host_parameters_attributes should only be used by the UI, not in the API - this shouldn't be considered a stable API.
We have a stable CRUD interface for parameters under /api/v2/hosts/:id/parameters.
Updated by Lukas Zapletal almost 9 years ago
- Status changed from Feedback to New
Well, we apparently expose this, it is documented and in use apparently. This is a regression and this is a valid ticket.
/home/lzap/work/foreman/app/controllers/api/v1/hosts_controller.rb: 46 param :puppet_ca_proxy_id, :number 47 param :image_id, :number 48: param :host_parameters_attributes, Array 49 param :build, :bool 50 param :enabled, :bool .. 88 param :puppet_ca_proxy_id, :number 89 param :image_id, :number 90: param :host_parameters_attributes, Array 91 param :build, :bool 92 param :enabled, :bool /home/lzap/work/foreman/app/controllers/api/v2/hosts_controller.rb: 63 param :puppet_ca_proxy_id, :number 64 param :image_id, :number 65: param :host_parameters_attributes, Array 66 param :build, :bool 67 param :enabled, :bool
Another CRUD is not a option for discovery users as the host is rebooted immediately.
Updated by Dominic Cleal almost 9 years ago
- Related to Bug #9815: HostGroup Clone doesn't work if the hostgroup has parameters added
Updated by Lukas Zapletal almost 9 years ago
Thanks for the link, my plan is to make sure the nested attribute is ignored as oVirt and RHEV already uses this API :-(
I will make a patch.
Updated by Dominic Cleal almost 9 years ago
- Translation missing: en.field_release set to 63
Be sure to mark it as deprecated then, it really shouldn't be used IMHO.
Updated by Lukas Zapletal almost 9 years ago
Do you mean to flag whole host_parameters_attributes as deprecated?
In discovery workflow, users cannot do more than one request. What if we simply filter out everything, but key/value pairs for both API V2 controllers (host/hostgroup)? That could do it.
Updated by Dominic Cleal almost 9 years ago
Lukas Zapletal wrote:
Do you mean to flag whole host_parameters_attributes as deprecated?
The "nested" attribute. I'd suggest a stern warning too on host_parameters_attributes, but probably not deprecate it formally.
Updated by The Foreman Bot almost 9 years ago
- Status changed from New to Ready For Testing
- Assignee set to Lukas Zapletal
- Pull request https://github.com/theforeman/foreman/pull/2928 added
Updated by Dominic Cleal almost 9 years ago
- Translation missing: en.field_release changed from 63 to 104
Updated by Dominic Cleal almost 9 years ago
- Related to Bug #12090: foreman-cli 0.4 does not work with foreman 1.10-dev added
Updated by Lukas Zapletal almost 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 7ee381e96915cf019f3f86830df0f79c5280e46e.