Bug 1135651

Summary: Host Create API documentation missing required parameters
Product: Red Hat Satellite Reporter: sthirugn <sthirugn>
Component: APIAssignee: jmagen <jmagen>
Status: CLOSED WONTFIX QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.3CC: bbuckingham, bkearney, dcleal, jaudet, jmagen, omaciel
Target Milestone: UnspecifiedKeywords: Reopened, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/7332
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-05 19:17:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1120800    

Description sthirugn@redhat.com 2014-08-29 22:22:05 UTC
Description of problem:

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Navigate to host API doc of sat6 installation -> Host Create - https://$host/apidoc/v2/hosts/create.html

2. Notice that "name" is the only required parameter

3.. Try one of these curl commands to create the host
#curl -X POST -H "Accept:application/json" -H "Content-Type: application/json" -u admin:changeme --insecure -d '{"host":{"name":"testhost1"}}' https://cloud-qe-14.idm.lab.bos.redhat.com/api/v2/hosts

# curl -X POST -H "Accept:application/json" -H "Content-Type: application/json" -u admin:changeme --insecure -d '{"name":"testhost1"}' https://cloud-qe-14.idm.lab.bos.redhat.com/api/v2/hosts

Actual results:
  "error": {"id":null,"errors":{"environment_id":["can't be blank"],"mac":["is invalid","can't be blank"],"architecture_id":["can't be blank"],"operatingsystem_id":["can't be blank"],"domain_id":["can't be blank"],"root_pass":["should be 8 characters or more","should not be blank - consider setting a global or host group default"],"ptable_id":["cant be blank unless a custom partition has been defined"]},"full_messages":["Environment can't be blank","MAC address is invalid","MAC address can't be blank","Architecture can't be blank","Operatingsystem can't be blank","Domain can't be blank","Root password should be 8 characters or more","Root password should not be blank - consider setting a global or host group default","Partition Table cant be blank unless a custom partition has been defined"]}

Expected results:
API doc should have updated list of required parameters

Additional info:

Comment 1 sthirugn@redhat.com 2014-08-29 22:27:08 UTC
Version Tested:
GA Snap 7 - Satellite-6.0.4-RHEL-6-20140828.0

* 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-
* foreman-compute-
* foreman-gce-
* foreman-libvirt-
* foreman-ovirt-
* foreman-postgresql-
* foreman-proxy-
* foreman-selinux-
* foreman-vmware-
* katello-1.5.0-30.el6sat.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.6-1.el6sat.noarch
* katello-installer-0.0.62-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-4.el6sat.noarch
* pulp-nodes-common-2.4.1-0.5.rc1.el6sat.noarch
* pulp-nodes-parent-2.4.1-0.5.rc1.el6sat.noarch
* pulp-puppet-plugins-2.4.1-0.5.rc1.el6sat.noarch
* pulp-puppet-tools-2.4.1-0.5.rc1.el6sat.noarch
* pulp-rpm-plugins-2.4.1-0.5.rc1.el6sat.noarch
* pulp-selinux-2.4.1-0.5.rc1.el6sat.noarch
* pulp-server-2.4.1-0.5.rc1.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 3 jmagen@redhat.com 2014-09-03 08:12:16 UTC
Create issue http://projects.theforeman.org/issues/7332

and fixed it.


Comment 5 Bryan Kearney 2014-10-14 08:04:04 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/7332 has been closed
Joseph Magen
Applied in changeset commit:5638cc6871ed231c259ae64e998ff5907bfb7bb5.

Comment 8 jaudet 2015-03-11 19:21:45 UTC
Tested against systems running:

* Satellite-6.1.0-RHEL-6-20150310.0
* Satellite-6.1.0-RHEL-7-20150310.0

The API documentation on both of those systems, at /apidoc/v2/hosts.html, states the following about the subnet_id parameter:

> host[subnet_id]
> optional , nil allowed
> required if host is managed and value is not inherited from host group
> Value: Must be a number.

However, this is not true. The `subnet_id` parameter is not required even when the host is managed and the host is not associated with any host groups. Below is a slightly redacted set of attributes for a host. See the "managed", and "hostgroup_id" and "subnet_id" parameters.

        u'all_puppetclasses': [],
        u'architecture_id': 72,
        u'architecture_name': u'\uc8c7\u9f89\u65b7',
        u'build': False,
        u'capabilities': [u'build'],
        u'certname': u'…',
        u'comment': None,
        u'compute_profile_id': None,
        u'compute_profile_name': None,
        u'compute_resource_id': None,
        u'compute_resource_name': None,
        u'config_groups': [],
        u'created_at': u'2015-03-11T18:53:45Z',
        u'disk': None,
        u'domain_id': 66,
        u'domain_name': u'cveswd6vcs',
        u'enabled': True,
        u'environment_id': 104,
        u'environment_name': u'89031',
        u'hostgroup_id': None,
        u'hostgroup_name': None,
        u'id': 38,
        u'image_file': u'',
        u'image_id': None,
        u'image_name': None,
        u'installed_at': None,
        u'interfaces': [],
        u'ip': None,
        u'last_compile': None,
        u'last_freshcheck': None,
        u'last_report': None,
        u'location_id': 339,
        u'location_name': u'\u554e\ua418\u040a',
        u'mac': u'41:50:2d:c3:26:87',
        u'managed': True,
        u'medium_id': 67,
        u'medium_name': u'\uccf1\u7182\U00027acd',
        u'model_id': None,
        u'model_name': None,
        u'name': u'bqeyfudavfflzlgjtyydditpq.cveswd6vcs',
        u'operatingsystem_id': 66,
        u'operatingsystem_name': u'\U00022ae6\u7e14\u3758',
        u'organization_id': 340,
        u'organization_name': u'\u4684\u9524\U00027d2a',
        u'owner_id': 3,
        u'owner_type': u'User',
        u'parameters': [],
        u'provision_method': u'build',
        u'ptable_id': 63,
        u'ptable_name': u'\u6a3e\ub372\uc865',
        u'puppet_ca_proxy_id': None,
        u'puppetclasses': [],
        u'puppet_proxy_id': None,
        u'puppet_status': 0,
        u'realm_id': None,
        u'realm_name': None,
        u'serial': None,
        u'source_file_id': None,
        u'sp_ip': None,
        u'sp_mac': None,
        u'sp_name': None,
        u'sp_subnet_id': None,
        u'subnet_id': None,
        u'subnet_name': None,
        u'updated_at': u'2015-03-11T18:53:45Z',
        u'use_image': None,
        u'uuid': None,

The list of required parameters is closer to being correct, but it is still wrong.

Comment 10 errata-xmlrpc 2015-08-12 05:15:38 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.


Comment 11 sthirugn@redhat.com 2015-08-14 20:45:04 UTC
Accidentally closed with 6.1.1 errata

Comment 12 Bryan Kearney 2016-04-06 20:07:19 UTC
Upstream bug assigned to jmagen

Comment 13 Bryan Kearney 2017-01-05 19:17:35 UTC
This is an older bug which has been reported upstream. We are not going to track this bug downstream. When the upstream issue is resolved, the next build will contain the fix. Thank you.