Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1154156 - /api/v2/hosts rejects POST request containing operatingsystem_id parameter
Summary: /api/v2/hosts rejects POST request containing operatingsystem_id parameter
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: Nightly
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: Shlomi Zadok
QA Contact: jaudet
URL: http://projects.theforeman.org/issues...
Whiteboard:
: 1154803 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-17 16:58 UTC by jaudet
Modified: 2017-02-23 20:52 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-12 05:18:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 7989 0 None None None 2016-04-22 15:56:15 UTC
Red Hat Product Errata RHSA-2015:1592 0 normal SHIPPED_LIVE Important: Red Hat Satellite 6.1.1 on RHEL 6 2015-08-12 09:04:35 UTC

Description jaudet 2014-10-17 16:58:34 UTC
Description of problem:
It is impossible to sucessfully POST the /hosts path.

When creating a host, an operating system ID is required via the operatingsystem_id parameter. However, the application responds with an HTTP 500 error:

    operatingsystem_id is not allowed as nested parameter for hosts. Allowed parameters are hostgroup_id, location_id, organization_id, environment_id (RuntimeError)

Version-Release number of selected component (if applicable):
Tested against a nightly build of Satellite 6 with the following packages installed:

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.32-1.el6.noarch
* candlepin-common-1.0.8-1.el6.noarch
* candlepin-selinux-0.9.32-1.el6.noarch
* candlepin-tomcat6-0.9.32-1.el6.noarch
* elasticsearch-0.90.10-7.el6.noarch
* foreman-1.7.0-0.develop.201410150839gitb948163.el6.noarch
* foreman-compute-1.7.0-0.develop.201410150839gitb948163.el6.noarch
* foreman-gce-1.7.0-0.develop.201410150839gitb948163.el6.noarch
* foreman-libvirt-1.7.0-0.develop.201410150839gitb948163.el6.noarch
* foreman-ovirt-1.7.0-0.develop.201410150839gitb948163.el6.noarch
* foreman-postgresql-1.7.0-0.develop.201410150839gitb948163.el6.noarch
* foreman-proxy-1.7.0-0.develop.201410101404git7961640.el6.noarch
* foreman-release-1.7.0-0.develop.201410150839gitb948163.el6.noarch
* foreman-selinux-1.7.0-0.develop.201409301113git2f345de.el6.noarch
* foreman-vmware-1.7.0-0.develop.201410150839gitb948163.el6.noarch
* katello-2.1.0-1.201410161306gite21feb2.el6.noarch
* katello-certs-tools-2.0.1-1.el6.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-2.1.0-1.201410151311git9100203.el6.noarch
* katello-repos-2.1.1-1.el6.noarch
* katello-server-ca-1.0-1.noarch
* openldap-2.4.23-32.el6_4.1.x86_64
* pulp-docker-plugins-0.2.1-0.2.beta.el6.noarch
* pulp-katello-0.3-3.el6.noarch
* pulp-nodes-common-2.5.0-0.7.beta.el6.noarch
* pulp-nodes-parent-2.5.0-0.7.beta.el6.noarch
* pulp-puppet-plugins-2.5.0-0.7.beta.el6.noarch
* pulp-puppet-tools-2.5.0-0.7.beta.el6.noarch
* pulp-rpm-plugins-2.5.0-0.7.beta.el6.noarch
* pulp-selinux-2.5.0-0.7.beta.el6.noarch
* pulp-server-2.5.0-0.7.beta.el6.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-ldap_fluff-0.3.2-1.el6.noarch
* ruby193-rubygem-net-ldap-0.3.1-2.el6.noarch
* ruby193-rubygem-runcible-1.2.0-1.el6.noarch

How reproducible:
100%

Steps to Reproduce:
See description and "Additional info:" section below.

Actual results:
No host is created.

Expected results:
A host is created.

Additional info:
Here's an example of parameters received by the API, taken from the application log file:

    {"host"=>{
        "operatingsystem_id"=>76,
        "root_pass"=>"[FILTERED]",
        "environment_id"=>103,
        "ptable_id"=>55,
        "medium_id"=>64,
        "organization_id"=>383,
        "mac"=>"1f:66:bb:75:5c:8e",
        "architecture_id"=>53,
        "location_id"=>384,
        "domain_id"=>58,
        "puppet_proxy_id"=>1,
        "name"=>"mZmHqfwWSejeJ"
    }, "apiv"=>"v2"}

Comment 1 RHEL Program Management 2014-10-17 17:03:00 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 jaudet 2014-10-17 17:19:38 UTC
The test suite has been updated to target this bug. See: https://github.com/SatelliteQE/robottelo/pull/1588

Comment 4 Dominic Cleal 2014-10-20 11:50:14 UTC
Created redmine issue http://projects.theforeman.org/issues/7989 from this bug

Comment 6 Dominic Cleal 2014-10-21 07:19:10 UTC
*** Bug 1154803 has been marked as a duplicate of this bug. ***

Comment 7 jaudet 2014-10-21 17:09:49 UTC
This issue also affects the `/config_templates` path. See: https://github.com/SatelliteQE/robottelo/pull/1606

Comment 8 jaudet 2014-10-21 17:15:03 UTC
Here's one of the messages received when submitting an update to a `/config_templates` path:

    {u'message': u'template_kind_id is not allowed as nested parameter for config_templates. Allowed parameters are operatingsystem_id, location_id, organization_id'}

Comment 9 Bryan Kearney 2014-10-22 10:04:50 UTC
Upstream bug assigned to szadok

Comment 10 Bryan Kearney 2014-11-13 13:04:18 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/7989 has been closed
-------------
Dominic Cleal
Reproduced and found the regression was introduced by:

<pre>
commit 453dc6939f607d8ae0ff4580b5562734c60b19c5
Author: Joseph Magen <jmagen>
Date:   Tue Oct 7 09:45:20 2014 +0300

    fixes #3492 - API v2 nested routes for each controller
</pre>

This isn't a nested route, it's just a parameter inside a hash.
-------------
Dominic Cleal
Was merged in https://github.com/theforeman/foreman/commit/47ab039e61ae3f29627de0a770fa0c6b41f33c47, wrong ticket number in the commit message.

Comment 13 jaudet 2015-03-06 20:45:58 UTC
Tested against both RHEL 6.6 and RHEL 7.1 sytems using Robottelo. Example test output:

    $ nosetests tests/foreman/api/test_multiple_paths.py -m Host
    .................SSSS
    ----------------------------------------------------------------------
    Ran 21 tests in 54.359s

    OK (SKIP=4)
    $ nosetests tests/foreman/api/test_multiple_paths.py -m ConfigTemplate
    .........SS
    ----------------------------------------------------------------------
    Ran 11 tests in 4.197s

    OK (SKIP=2)
    $ nosetests tests/foreman/api/test_multiple_paths.py -m User
    ..................S.SS
    ----------------------------------------------------------------------
    Ran 22 tests in 17.836s

    OK (SKIP=3)

Comment 14 Bryan Kearney 2015-08-11 13:30:58 UTC
This bug is slated to be released with Satellite 6.1.

Comment 15 errata-xmlrpc 2015-08-12 05:18:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2015:1592


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