Project

General

Profile

Bug #18800

content_facet_attributes no longer optional on api/hosts

Added by Klaas D over 2 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Category:
Host groups
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Hi,
I'm having an issue after the update to katello 3.3/foreman 1.14. I've been using a simple json to create testservers via api after upgrading and my json stopped working:

# cat testserver.json
{
  "host" : {
    "name" : "el7testvmd001",
    "location_id" : "2",
    "organization_id" : "1",
    "compute_resource_id" : "1",
    "compute_profile_id" : "1",
    "hostgroup_id" : "1",
    "build" : true,
    "interfaces_attributes" : [ {
      "identifier" : "eth0",
      "name" : "el7testvmd001",
      "managed" : true,
      "primary" : true,
      "provision" : true,
      "subnet_id" : 9,
      "domain_id" : 1
    }, {
      "identifier" : "eth1",
      "name" : "el7testvmd001a",
      "managed" : true,
      "primary" : false,
      "provision" : false,
      "subnet_id" : 1,
      "domain_id" : 1
    }, {
      "identifier" : "eth2",
      "name" : "el7testvmd001s",
      "managed" : true,
      "primary" : false,
      "provision" : false,
      "subnet_id" : 6,
      "domain_id" : 1
    }, {
      "identifier" : "eth3",
      "name" : "el7testvmd001n",
      "managed" : true,
      "primary" : false,
      "provision" : false,
      "subnet_id" : 5,
      "domain_id" : 1
    } ]
  }
}
# curl -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X POST -u admin:password -k --data @testserver.json https://foremanserver.tld/api/hosts
{
  "error": {"message":"ActiveModel::ForbiddenAttributesError"}
}

if I add

"content_facet_attributes" : {},

it works as expected again

I'm not sure if this change was on purpose and its a documentation fix or if the code needs to be touched.

Greetings
Klaas


Related issues

Related to Discovery - Bug #18791: Discovery v8.0.1 provisioning throws ActiveModel::ForbiddenAttributesError when Katello is installed.Closed2017-03-03
Related to Discovery - Bug #20797: Provisioning errors with undefined method permit! for ActiveSupport::HashWithIndifferentAccessResolved2017-08-29

Associated revisions

Revision ff74c383 (diff)
Added by Lukas Zapletal over 2 years ago

Fixes #18800 - strong params no longer breaks inherited attrs

Revision 0b79692b (diff)
Added by Lukas Zapletal over 2 years ago

Fixes #18800 - strong params no longer breaks inherited attrs

(cherry picked from commit ff74c383574a43952a9c9c371f407a20e5f7bc5a)

History

#1 Updated by Klaas D over 2 years ago

  • Related to Bug #18791: Discovery v8.0.1 provisioning throws ActiveModel::ForbiddenAttributesError when Katello is installed. added

#2 Updated by Lukas Zapletal over 2 years ago

  • Project changed from Katello to Foreman
  • Category set to Host groups

I believe you are hitting same issue as in #18791. I think we need to call to_h in the method. I am changing project as this is core feature.

#3 Updated by The Foreman Bot over 2 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Lukas Zapletal
  • Pull request https://github.com/theforeman/foreman/pull/4364 added

#4 Updated by Timo Goebel over 2 years ago

  • Legacy Backlogs Release (now unused) set to 227

I'd suggest putting this on 1.14.3. If anybody object, feel free to change the parameter.

#5 Updated by Lukas Zapletal over 2 years ago

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

#6 Updated by Lukas Zapletal almost 2 years ago

  • Related to Bug #20797: Provisioning errors with undefined method permit! for ActiveSupport::HashWithIndifferentAccess added

Also available in: Atom PDF