Bug 1114640 - Can't create parameters for operating system with id 1 using API
Summary: Can't create parameters for operating system with id 1 using API
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Provisioning
Version: 6.0.4
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: Unspecified
Assignee: jmagen@redhat.com
QA Contact: sthirugn@redhat.com
URL: http://projects.theforeman.org/issues...
Whiteboard:
Keywords: Triaged
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-30 14:21 UTC by Bryan Kearney
Modified: 2016-04-22 16:06 UTC (History)
5 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2014-09-11 12:20:29 UTC


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 6375 None None None 2016-04-22 16:06 UTC

Description Bryan Kearney 2014-06-30 14:21:47 UTC
When you try to create a new parameter for operating system with id 1, you result in 422 error

<pre>
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)
</pre>

The issue is in that reference_id is set to nil (this is inspect of @parameter from create action)

<pre>
#<OsParameter id: nil, name: "ssh_public_key", value: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5mX2JV6T6CVCRmT...", reference_id: nil, created_at: nil, updated_at: nil, type: "OsParameter", priority: 2>
</pre>

git bisect found #5129 and "691f0a1a809569d125e9385e60f8f1e1c8d88061":http://projects.theforeman.org/projects/foreman/repository/revisions/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

Comment 1 Bryan Kearney 2014-06-30 14:21:48 UTC
Created from redmine issue http://projects.theforeman.org/issues/6375

Comment 2 Bryan Kearney 2014-06-30 14:21:53 UTC
Upstream bug assigned to jmagen@redhat.com

Comment 4 jmagen@redhat.com 2014-07-07 14:15:54 UTC
fixed
https://github.com/theforeman/foreman/pull/1567

Comment 6 Bryan Kearney 2014-07-22 08:03:44 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/6375 has been closed
-------------
Joseph Magen
https://github.com/theforeman/foreman/pull/1567
-------------
Joseph Magen
Applied in changeset commit:5dded9172adeadb8ef0f56a33787b213784551a4.

Comment 9 jaudet 2014-08-04 17:51:25 UTC
Created a GitHub issue to track progress on tracking this issue. See: https://github.com/omaciel/robottelo/issues/1128

Comment 10 sthirugn@redhat.com 2014-08-25 20:15:32 UTC
Verified.

# curl -X POST -H "Accept:application/json" -H "Content-Type: application/json" -u admin:changeme --insecure -d '{"operatingsystem_id":"1","parameter":{"name":"awesomename1","value":"nicevalue1"}}' https://sat6host/api/v2/operatingsystems/1/parameters

{"id":7,"name":"awesomename1","value":"nicevalue1","priority":2,"created_at":"2014-08-25T20:14:54Z","updated_at":"2014-08-25T20:14:54Z"}

Version Tested:
GA Snap 6 - Satellite-6.0.4-RHEL-6-20140820.1

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.23-1.el6_5.noarch
* candlepin-common-1.0.1-1.el6_5.noarch
* candlepin-scl-1-5.el6_4.noarch
* candlepin-scl-quartz-2.1.5-5.el6_4.noarch
* candlepin-scl-rhino-1.7R3-1.el6_4.noarch
* candlepin-scl-runtime-1-5.el6_4.noarch
* candlepin-selinux-0.9.23-1.el6_5.noarch
* candlepin-tomcat6-0.9.23-1.el6_5.noarch
* elasticsearch-0.90.10-6.el6sat.noarch
* foreman-1.6.0.41-1.el6sat.noarch
* foreman-compute-1.6.0.41-1.el6sat.noarch
* foreman-gce-1.6.0.41-1.el6sat.noarch
* foreman-libvirt-1.6.0.41-1.el6sat.noarch
* foreman-ovirt-1.6.0.41-1.el6sat.noarch
* foreman-postgresql-1.6.0.41-1.el6sat.noarch
* foreman-proxy-1.6.0.29-1.el6sat.noarch
* foreman-selinux-1.6.0.7-1.el6sat.noarch
* foreman-vmware-1.6.0.41-1.el6sat.noarch
* katello-1.5.0-29.el6sat.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.6-1.el6sat.noarch
* katello-installer-0.0.60-1.el6sat.noarch
* openldap-2.4.23-34.el6_5.1.x86_64
* openldap-devel-2.4.23-34.el6_5.1.x86_64
* pulp-katello-0.3-3.el6sat.noarch
* pulp-nodes-common-2.4.0-0.30.beta.el6sat.noarch
* pulp-nodes-parent-2.4.0-0.30.beta.el6sat.noarch
* pulp-puppet-plugins-2.4.0-0.30.beta.el6sat.noarch
* pulp-puppet-tools-2.4.0-0.30.beta.el6sat.noarch
* pulp-rpm-plugins-2.4.0-0.30.beta.el6sat.noarch
* pulp-selinux-2.4.0-0.30.beta.el6sat.noarch
* pulp-server-2.4.0-0.30.beta.el6sat.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-net-ldap-0.3.1-3.el6sat.noarch
* ruby193-rubygem-runcible-1.1.0-2.el6sat.noarch

Comment 11 Bryan Kearney 2014-09-11 12:20:29 UTC
This was delivered with Satellite 6.0 which was released on 10 September 2014.


Note You need to log in before you can comment on or make changes to this bug.