Bug #13849
closedupdating a host's facet should not require the facet id to be included in facet params
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" } } }
Updated by Shimon Shtein over 8 years ago
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).
Updated by Thomas McKay over 8 years ago
I used apipie so whatever is present there (PUT I assume)
Updated by Justin Sherrill over 8 years ago
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.
Updated by Justin Sherrill over 8 years ago
- Blocks Feature #11435: Host Unification Tracker added
Updated by The Foreman Bot over 8 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/3254 added
Updated by Shimon Shtein over 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset ec76b0092f9af5b8f7e2e02777f376b6b6e0d711.
Updated by Dominic Cleal over 8 years ago
- Translation missing: en.field_release set to 141