Project

General

Profile

Actions

Bug #13849

closed

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

Added by Thomas McKay over 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
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 1 (1 open0 closed)

Blocks Katello - Feature #11435: Host Unification TrackerNewActions
Actions #1

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).

Actions #2

Updated by Thomas McKay over 8 years ago

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

Actions #3

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.

Actions #4

Updated by Justin Sherrill over 8 years ago

  • Bugzilla link set to 1312107
Actions #5

Updated by Justin Sherrill over 8 years ago

Actions #6

Updated by Shimon Shtein over 8 years ago

  • Assignee set to Shimon Shtein
Actions #7

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
Actions #8

Updated by Shimon Shtein over 8 years ago

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

Updated by Dominic Cleal over 8 years ago

  • Translation missing: en.field_release set to 141
Actions

Also available in: Atom PDF