Actions
Bug #6375
closedCan't create parameters for operating system with id 1 using API
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Description
When you try to create a new parameter for operating system with id 1, you result in 422 error
Started POST "/api/operatingsystems/1/parameters" for 192.168.122.22 at 2014-06-25 08:46:15 +0000 Processing by Api::V2::ParametersController#create as JSON Parameters: {"parameter"=>{"value"=>"[FILTERED]", "name"=>"ssh_public_key"}, "apiv"=>"v2", "operatingsystem_id"=>"1"} Authorized user admin(Admin User) Unprocessable entity OsParameter (id: new): Reference parameters require an associated domain, host or host group Rendered api/v2/errors/unprocessable_entity.json.rabl within api/v2/layouts/error_layout (1.3ms) Completed 422 Unprocessable Entity in 657ms (Views: 2.4ms | ActiveRecord: 299.7ms)
The issue is in that reference_id is set to nil (this is inspect of @parameter from create action)
#<OsParameter id: nil, name: "ssh_public_key", value: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5mX2JV6T6CVCRmT...", reference_id: nil, created_at: nil, updated_at: nil, type: "OsParameter", priority: 2>
git bisect found #5129 and 691f0a1a809569d125e9385e60f8f1e1c8d88061 as a source of the issue. It seems that for some reason we enforce nil for reference_id when it's set to 1. Related PR https://github.com/theforeman/foreman/pull/1504. Note that it was merged to 1.5.2
Updated by Marek Hulán over 10 years ago
- Subject changed from Can't create parameters for operating systems using API to Can't create parameters for operating system with id 1 using API
- Description updated (diff)
Updated by Dominic Cleal over 10 years ago
- Status changed from New to Assigned
- Assignee set to Joseph Magen
- Target version set to 1.8.1
- Translation missing: en.field_release set to 18
Thanks, that should've been obvious...
Updated by Anonymous about 10 years ago
- Target version changed from 1.8.1 to 1.8.0
Updated by Joseph Magen about 10 years ago
- Status changed from Assigned to Ready For Testing
Updated by Dominic Cleal about 10 years ago
- Related to Bug #5129: Host Group creation may fail if Host Group with id 1 exists with same parameter name added
Updated by Joseph Magen about 10 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 5dded9172adeadb8ef0f56a33787b213784551a4.
Updated by The Foreman Bot about 10 years ago
- Pull request https://github.com/theforeman/foreman/pull/1567 added
Updated by Tomer Brisker over 8 years ago
- Related to Refactor #14934: Remove Rails 3.2.8 workaround in parameter model added
Actions