Bug #13849
closed
updating a host's facet should not require the facet id to be included in facet params
Added by Thomas McKay almost 9 years ago.
Updated over 6 years ago.
Description
Instead of requiring an update to a host's facet attributes to include the ID of the facet, look up the needed ID in the API controller and add to params. Facet IDs are not, imho, a user-facing aspect that needs to be exposed.
{
host_id: 123,
host: {
name: "abc.example.com",
content_facet_attributes: {
id: 1234, <---- REMOVE
lifecycle_environment_id: 12,
content_view_id: 12
},
subscription_facet_attributes: {
id: 1234, <---- REMOVE
service_level: "Premium"
}
}
}
Related issues
1 (1 open — 0 closed)
Which method did you use, PUT or PATCH?
PUT is full update, so I would expect the id to be there, but in PATCH I don't think you have to specify the id (or any other field that you don't want to update for that matter).
I used apipie so whatever is present there (PUT I assume)
I see the same issue with PATCH /api/v2/hosts/3
This works fine:
{"subscription_facet_attributes": {"id": 8,"service_level": "foo"}}
But this does not:
{"subscription_facet_attributes": {"service_level": "foo"}}
It appears ends up trying to create a new subscription facet with a null id.
- Bugzilla link set to 1312107
- Assignee set to Shimon Shtein
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/3254 added
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
- Translation missing: en.field_release set to 141
Also available in: Atom
PDF