Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1154156 - /api/v2/hosts rejects POST request containing operatingsystem_id parameter
/api/v2/hosts rejects POST request containing operatingsystem_id parameter
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API (Show other bugs)
Nightly
Unspecified Unspecified
unspecified Severity high (vote)
: Unspecified
: Unused
Assigned To: Shlomi Zadok
jaudet
http://projects.theforeman.org/issues...
: Regression, Triaged
: 1154803 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-10-17 12:58 EDT by jaudet
Modified: 2017-02-23 15:52 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-08-12 01:18:13 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 7989 None None None 2016-04-22 11:56 EDT
Red Hat Product Errata RHSA-2015:1592 normal SHIPPED_LIVE Important: Red Hat Satellite 6.1.1 on RHEL 6 2015-08-12 05:04:35 EDT

  None (edit)
Description jaudet 2014-10-17 12:58:34 EDT
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 Product and Program Management 2014-10-17 13:03:00 EDT
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 13:19:38 EDT
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 07:50:14 EDT
Created redmine issue http://projects.theforeman.org/issues/7989 from this bug
Comment 6 Dominic Cleal 2014-10-21 03:19:10 EDT
*** Bug 1154803 has been marked as a duplicate of this bug. ***
Comment 7 jaudet 2014-10-21 13:09:49 EDT
This issue also affects the `/config_templates` path. See: https://github.com/SatelliteQE/robottelo/pull/1606
Comment 8 jaudet 2014-10-21 13:15:03 EDT
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 06:04:50 EDT
Upstream bug assigned to szadok@redhat.com
Comment 10 Bryan Kearney 2014-11-13 08:04:18 EST
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@redhat.com>
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 15:45:58 EST
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 09:30:58 EDT
This bug is slated to be released with Satellite 6.1.
Comment 15 errata-xmlrpc 2015-08-12 01:18:13 EDT
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.