Project

General

Profile

Bug #13849

updating a host's facet should not require the facet id to be included in facet params

Added by Thomas McKay almost 4 years ago. Updated over 1 year ago.

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

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

Blocks Katello - Feature #11435: Host Unification TrackerNew

Associated revisions

Revision ec76b009 (diff)
Added by Shimon Shtein almost 4 years ago

Fixes #13849 - Now the facets will not require id attribute for update

Revision 91b4e718 (diff)
Added by Shimon Shtein over 3 years ago

Fixes #13849 - Now the facets will not require id attribute for update

(cherry picked from commit ec76b0092f9af5b8f7e2e02777f376b6b6e0d711)

History

#1 Updated by Shimon Shtein almost 4 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).

#2 Updated by Thomas McKay almost 4 years ago

I used apipie so whatever is present there (PUT I assume)

#3 Updated by Justin Sherrill almost 4 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.

#4 Updated by Justin Sherrill almost 4 years ago

  • Bugzilla link set to 1312107

#5 Updated by Justin Sherrill almost 4 years ago

#6 Updated by Shimon Shtein almost 4 years ago

  • Assignee set to Shimon Shtein

#7 Updated by The Foreman Bot almost 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3254 added

#8 Updated by Shimon Shtein almost 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#9 Updated by Dominic Cleal almost 4 years ago

  • Legacy Backlogs Release (now unused) set to 141

Also available in: Atom PDF