Red Hat Bugzilla – Bug 1154156
/api/v2/hosts rejects POST request containing operatingsystem_id parameter
Last modified: 2017-02-23 15:52:15 EST
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"}
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.
The test suite has been updated to target this bug. See: https://github.com/SatelliteQE/robottelo/pull/1588
Created redmine issue http://projects.theforeman.org/issues/7989 from this bug
*** Bug 1154803 has been marked as a duplicate of this bug. ***
This issue also affects the `/config_templates` path. See: https://github.com/SatelliteQE/robottelo/pull/1606
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'}
Upstream bug assigned to szadok@redhat.com
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.
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)
This bug is slated to be released with Satellite 6.1.
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