Bug 1126376 - content-host creation fails with 'Facts can't be blank'
Summary: content-host creation fails with 'Facts can't be blank'
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API
Version: 6.0.4
Hardware: Unspecified
OS: Unspecified
urgent
urgent vote
Target Milestone: Unspecified
Assignee: Christine Fouant
QA Contact: sthirugn@redhat.com
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks: 1112664
TreeView+ depends on / blocked
 
Reported: 2014-08-04 09:51 UTC by Tomas Lestach
Modified: 2016-04-22 15:49 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-09-11 12:22:48 UTC


Attachments (Terms of Use)
relevant part of /var/log/foreman/production.log (19.90 KB, text/plain)
2014-08-04 09:51 UTC, Tomas Lestach
no flags Details


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 6937 None None None 2016-04-22 15:49:02 UTC

Description Tomas Lestach 2014-08-04 09:51:54 UTC
Created attachment 923826 [details]
relevant part of /var/log/foreman/production.log

Description of problem:
When creating content-host, creation fails with:
Validation failed: Facts can't be blank (ActiveRecord::RecordInvalid)
even if facts are set. This is a regression.

Version-Release number of selected component (if applicable):
Satellite-6.0.4-RHEL-6-20140730.0-Satellite-x86_64

How reproducible:
always

Steps to Reproduce:
1. 
curl -s -H "Content-Type:application/json" -H "Accept:application/json,version=2" -k -u admin:changeme -d '{"type":"system", "facts":{"release":"6Server", "architecture":"x86_64"}, "host_colletion_id":{}, "organization_id":3, "description":"Initial Registration Parameters:\nOS: redhat-release-server\nRelease: 6Server\nCPU Arch: x86_64\nsat5_system_id: 1000020000", "name":"mysytem-123.example.com"}' $(hostname)/katello/api/systems

Actual results:
{"displayMessage":"Validation failed: Facts can't be blank","errors":{"facts":["can't be blank"]}}

Expected results:
Content host created.

Additional info:
This is a regression, same command worked with Satellite-6.0.4-RHEL-6-20140723.0-Satellite-x86_64 as expected.
This bug blocks migration of content-hosts.

Comment 2 Brad Buckingham 2014-08-05 12:19:15 UTC
It appears that this issue has been solved with katello PR:

https://github.com/Katello/katello/pull/4508

Without the PR:

$ curl -s -H "Content-Type:application/json" -H "Accept:application/json,version=2" -k -u admin:changeme -d '{"type":"system", "facts":{"release":"6Server", "architecture":"x86_64"}, "host_colletion_id":{}, "organization_id":1, "environment_id":1, "description":"Initial Registration Parameters:\nOS: redhat-release-server\nRelease: 6Server\nCPU Arch: x86_64\nsat5_system_id: 1000020000", "name":"mysytem-123.example.com"}' http://$(hostname):3000/katello/api/systems
{"displayMessage":"Validation failed: Facts can't be blank","errors":{"facts":["can't be blank"]}}[bbucking@fortello action

With the PR:

$ curl -s -H "Content-Type:application/json" -H "Accept:application/json,version=2" -k -u admin:changeme -d '{"type":"system", "facts":{"release":"6Server", "architecture":"x86_64"}, "host_colletion_id":{}, "organization_id":1, "environment_id":1, "description":"Initial Registration Parameters:\nOS: redhat-release-server\nRelease: 6Server\nCPU Arch: x86_64\nsat5_system_id: 1000020000", "name":"mysytem-123.example.com"}' http://$(hostname):3000/katello/api/systems
{"id":3,"uuid":"47c23d72-a306-4315-8452-20439d3101f0","name":"mysytem-123.example.com","description":"Initial Registration Parameters:\nOS: redhat-release-server\nRelease: 6Server\nCPU Arch: x86_64\nsat5_system_id: 1000020000","location":"None","content_view":{"composite":null,"created_at":"2014-07-26T14:20:32Z","default":true,"description":null,"id":1,"label":"Default_Organization_View","name":"Default Organization View","next_version":1,"organization_id":1,"updated_at":"2014-07-26T14:20:32Z"},"content_view_id":1,"distribution":" ","content_overrides":[],"entitlementStatus":"valid","autoheal":true,"href":"/consumers/47c23d72-a306-4315-8452-20439d3101f0","release":null,"checkin_time":null,"created":"2014-08-05T12:13:23.877+0000","installedProducts":[],"service_level":"","release_ver":null,"permissions":{"editable":true},"products":[],"host":null,"hostCollections":[],"customInfo":[],"environment":{"id":1,"name":"Library","label":"Library","description":null,"organization":{"name":"Default_Organization","label":"Default_Organization"},"created_at":"2014-07-26T14:20:31Z","updated_at":"2014-07-26T14:20:31Z","library":true,"prior":null,"permissions":{"view_lifecycle_environments":true,"edit_lifecycle_environments":true,"destroy_lifecycle_environments":true,"promote_or_remove_content_views_to_environments":true}},"activation_keys":[]}

Comment 3 Christine Fouant 2014-08-05 13:57:19 UTC
https://github.com/Katello/katello/pull/4508 will fix this

Comment 4 Christine Fouant 2014-08-05 14:53:29 UTC
Created redmine issue http://projects.theforeman.org/issues/6937 from this bug

Comment 5 Bryan Kearney 2014-08-07 00:04:28 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/6937 has been closed
-------------
Christine Fouant
Applied in changeset commit:katello|6f38a256be89400a4900429bdad7ff78e2e3f101.

Comment 6 Tomas Lestach 2014-08-08 09:49:58 UTC
I see the same error with Satellite-6.0.4-RHEL-6-20140806.0-Satellite-x86_64 compose.

Comment 7 Brad Buckingham 2014-08-11 12:30:01 UTC
*** Bug 1128455 has been marked as a duplicate of this bug. ***

Comment 10 sthirugn@redhat.com 2014-08-14 03:53:30 UTC
Verified using API. Now I am able to create content host by passing facts.

# curl -X POST -H "Accept:application/json" -H "Content-Type: application/json" -u admin:changeme --insecure -d '{"type":"system","facts":{"release":"6Server", "architecture":"x86_64"}, "organization_id":3, "name":"testsystem1.redhat.com","environment_id":3, "content_view_id":3}' https://test.redhat.com/katello/api/systems

Success!

Version Tested:
GA Snap 5 - Satellite-6.0.4-RHEL-6-20140813.2

* 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-4.el6sat.noarch
* foreman-1.6.0.40-1.el6sat.noarch
* foreman-compute-1.6.0.40-1.el6sat.noarch
* foreman-gce-1.6.0.40-1.el6sat.noarch
* foreman-libvirt-1.6.0.40-1.el6sat.noarch
* foreman-ovirt-1.6.0.40-1.el6sat.noarch
* foreman-postgresql-1.6.0.40-1.el6sat.noarch
* foreman-proxy-1.6.0.27-1.el6sat.noarch
* foreman-selinux-1.6.0.6-1.el6sat.noarch
* foreman-vmware-1.6.0.40-1.el6sat.noarch
* katello-1.5.0-28.el6sat.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.6-1.el6sat.noarch
* katello-installer-0.0.59-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-3.el6sat.noarch
* pulp-nodes-common-2.4.0-0.30.beta.el6sat.noarch
* pulp-nodes-parent-2.4.0-0.30.beta.el6sat.noarch
* pulp-puppet-plugins-2.4.0-0.30.beta.el6sat.noarch
* pulp-puppet-tools-2.4.0-0.30.beta.el6sat.noarch
* pulp-rpm-plugins-2.4.0-0.30.beta.el6sat.noarch
* pulp-selinux-2.4.0-0.30.beta.el6sat.noarch
* pulp-server-2.4.0-0.30.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

Comment 11 Bryan Kearney 2014-09-11 12:22:48 UTC
This was delivered with Satellite 6.0 which was released on 10 September 2014.


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