Bug 872334 - existing orgs do not get default value for system_info_keys in database
existing orgs do not get default value for system_info_keys in database
Status: CLOSED ERRATA
Product: Subscription Asset Manager
Classification: Red Hat
Component: katello (Show other bugs)
1.2
Unspecified Unspecified
unspecified Severity medium
: rc
: ---
Assigned To: Katello Bug Bin
Og Maciel
: Triaged
Depends On: 870456
Blocks: sam12-tracker
  Show dependency treegraph
 
Reported: 2012-11-01 16:03 EDT by Adam Price
Modified: 2013-02-21 14:18 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 870456
Environment:
Last Closed: 2013-02-21 14:18:36 EST
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)

  None (edit)
Description Adam Price 2012-11-01 16:03:28 EDT
+++ This bug was initially created as a clone of Bug #870456 +++

NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each
/home/tomckay/code/katello/src/app/models/system.rb:230:in `init_default_custom_info_keys'

When registering a system against an org created prior to custom_info_keys

--- Additional comment from adprice@redhat.com on 2012-10-29 13:49:21 EDT ---

https://github.com/Katello/katello/commit/2617576d9d230f282bdbcb01afd932547410ab82

--- Additional comment from adprice@redhat.com on 2012-10-29 13:50:55 EDT ---

if you hit an error similar to this:

NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each
/home/tomckay/code/katello/src/app/models/system.rb:230:in
`init_default_custom_info_keys'

it means you had at least one org that existed prior to default system
info keys.

run 'rake db:migrate:redo VERSION=20120924211134' on current-master to undo the
system_info_keys migration and correctly apply the new column to all
pre-existing organizations.

If any of your organizations had any data in the system_info_keys
column, unfortunately it will be removed.
Comment 2 Adam Price 2012-11-15 09:29:49 EST
this was caused by having an organization that existed prior to the migration that added Organization's system_info_keys.

to verify:

1. Create an organization prior to the existence of system_info_keys.
2. migrate the db to add org system_info_keys
3. check to see if pre-existing org has system_info_keys = [] (should not be nil)
Comment 3 Og Maciel 2012-11-15 10:19:36 EST
To verify this, first install 1.0 or 1.1 and create an org. Then upgrade to 1.2. The verification itself is via cli.
Comment 5 Og Maciel 2012-11-27 15:28:38 EST
Before the update:
------------------

# headpin -u admin -p admin org info --name SAMQE
-----------------------------------------------------------------------------------------------------
                                      Organization Information
-----------------------------------------------------------------------------------------------------

Id:          2
Name:        SAMQE
Description:


After the update:
-----------------

# headpin -u admin -p admin org info --name SAMQE-----------------------------------------------------------------------------------------------------
                                      Organization Information
-----------------------------------------------------------------------------------------------------

Id                       : 2
Name                     : SAMQE
Description:
    
Available Service Levels:
    Premium
Default System Info Keys:
    [  ]
Comment 6 Og Maciel 2012-11-27 15:30:00 EST
Verified:
* candlepin-0.7.19-1.el6_3.noarch
* candlepin-tomcat6-0.7.19-1.el6_3.noarch
* katello-candlepin-cert-key-pair-1.0-1.noarch
* katello-certs-tools-1.2.1-1h.el6_3.noarch
* katello-cli-1.2.4-2h.el6_3.noarch
* katello-cli-common-1.2.4-2h.el6_3.noarch
* katello-common-1.2.6-2h.el6_3.noarch
* katello-configure-1.2.3-1h.el6_3.noarch
* katello-glue-candlepin-1.2.6-2h.el6_3.noarch
* katello-headpin-1.2.6-2h.el6_3.noarch
* katello-headpin-all-1.2.6-2h.el6_3.noarch
* katello-selinux-1.2.1-1h.el6_3.noarch
* thumbslug-0.0.27-1.el6_3.noarch
* thumbslug-selinux-0.0.27-1.el6_3.noarch
Comment 8 errata-xmlrpc 2013-02-21 14:18:36 EST
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.

http://rhn.redhat.com/errata/RHSA-2013-0544.html

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