Bug 1125003

Summary: API error while creating a new OperatingSystem with incorrect data types
Product: Red Hat Satellite Reporter: Og Maciel <omaciel>
Component: APIAssignee: Dominic Cleal <dcleal>
Status: CLOSED ERRATA QA Contact: jaudet
Severity: low Docs Contact:
Priority: low    
Version: 6.0.3CC: bbuckingham, mmccune
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/6851
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 05:12:08 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:
Embargoed:

Description Og Maciel 2014-07-30 19:50:57 UTC
Description of problem:

Our automation has shown that creating an operating system via the API is failing when providing the 'minor' version field with the following error:

  undefined method `empty?' for 10:Fixnum

curl -X POST -k  -u admin:changeme https://SERVER/api/v2/operatingsystems -d {"operatingsystem": {"major": 1, "release_name": "osrelease246", "name": "OperatingSystem_2799", "minor": 10, "family": "Redhat"}} 

 500 
 {
  "error": {"message":"undefined method `empty?' for 10:Fixnum"}
}


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

Build: atellite-6.0.4-RHEL-6-20140730.0

Packages:

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.19-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.19-1.el6_5.noarch
* candlepin-tomcat6-0.9.19-1.el6_5.noarch
* elasticsearch-0.90.10-4.el6sat.noarch
* foreman-1.6.0.34-1.el6sat.noarch
* foreman-compute-1.6.0.34-1.el6sat.noarch
* foreman-gce-1.6.0.34-1.el6sat.noarch
* foreman-libvirt-1.6.0.34-1.el6sat.noarch
* foreman-ovirt-1.6.0.34-1.el6sat.noarch
* foreman-postgresql-1.6.0.34-1.el6sat.noarch
* foreman-proxy-1.6.0.23-1.el6sat.noarch
* foreman-selinux-1.6.0.4-1.el6sat.noarch
* foreman-vmware-1.6.0.34-1.el6sat.noarch
* katello-1.5.0-27.el6sat.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.6-1.el6sat.noarch
* katello-installer-0.0.56-1.el6sat.noarch
* openldap-2.4.23-31.el6.x86_64
* pulp-katello-0.3-3.el6sat.noarch
* pulp-nodes-common-2.4.0-0.23.beta.el6sat.noarch
* pulp-nodes-parent-2.4.0-0.23.beta.el6sat.noarch
* pulp-puppet-plugins-2.4.0-0.23.beta.el6sat.noarch
* pulp-puppet-tools-2.4.0-0.23.beta.el6sat.noarch
* pulp-rpm-plugins-2.4.0-0.23.beta.el6sat.noarch
* pulp-selinux-2.4.0-0.23.beta.el6sat.noarch
* pulp-server-2.4.0-0.23.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
* rubygem-hammer_cli-0.1.1-11.el6sat.noarch
* rubygem-hammer_cli_foreman-0.1.1-15.el6sat.noarch
* rubygem-hammer_cli_foreman_tasks-0.0.3-3.el6sat.noarch
* rubygem-hammer_cli_katello-0.0.4-10.el6sat.noarch

How reproducible:


Steps to Reproduce:
1. Use the API to create a new operating system, providing the 'minor' version
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Og Maciel 2014-07-30 19:51:22 UTC
Somehow this doesn't seem to affect the UI.

Comment 3 Dominic Cleal 2014-07-31 07:01:26 UTC
Both minor and major are strings, not integers, as per the API doc:
http://theforeman.org/api/apidoc/v2/operatingsystems/create.html

Comment 4 Dominic Cleal 2014-07-31 07:01:45 UTC
Created redmine issue http://projects.theforeman.org/issues/6851 from this bug

Comment 5 Bryan Kearney 2015-01-19 11:03:08 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/6851 has been closed
-------------
Dominic Cleal
Appears to have been fixed here: https://github.com/theforeman/foreman/commit/8b737c9c7648b3726dadb3b2e4708fcb43af02a8#diff-ca0b1ebc260d7633163da1e5450eabb9L137

Comment 8 jaudet 2015-03-09 14:11:25 UTC
Tested against Satellite-6.1.0-RHEL-6-20150303.0 and Satellite-6.1.0-RHEL-7-20150303.0. Automated tests for this bug should be added to QE's test suite shortly. See: https://github.com/SatelliteQE/robottelo/pull/1974

Comment 9 Bryan Kearney 2015-08-11 13:31:39 UTC
This bug is slated to be released with Satellite 6.1.

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