Bug 1343999

Summary: upgrade failure if any system not properly registered
Product: Red Hat Satellite Reporter: Justin Sherrill <jsherril>
Component: Content ManagementAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, jcallaha, lpramuk, sghai
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/15301
Whiteboard:
Fixed In Version: rubygem-katello-3.0.0.48-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:34:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1335807    

Description Justin Sherrill 2016-06-08 13:15:45 UTC
During db:migrate getting the following error:

<pre>
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
== 20150930183738 MigrateContentHosts: migrating ==============================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method `inject' for nil:NilClass/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/app/lib/katello/http_resource.rb:197:in `hash_to_query'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/app/lib/katello/resources/candlepin.rb:102:in `get'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/db/migrate/20150930183738_migrate_content_hosts.rb:118:in `backend_data'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/db/migrate/20150930183738_migrate_content_hosts.rb:122:in `facts'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/db/migrate/20150930183738_migrate_content_hosts.rb:212:in `block in get_systems_with_facts'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/db/migrate/20150930183738_migrate_content_hosts.rb:210:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/db/migrate/20150930183738_migrate_content_hosts.rb:210:in `get_systems_with_facts'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/db/migrate/20150930183738_migrate_content_hosts.rb:252:in `ensure_one_system_per_hostname'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/db/migrate/20150930183738_migrate_content_hosts.rb:313:in `up'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:598:in `exec_migration'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/opt/rh/rh-ruby22/root/usr/share/ruby/benchmark.rb:288:in `measure'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:578:in `block in migrate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:577:in `migrate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:752:in `migrate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:1038:in `block in ddl_transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:208:in `transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:1038:in `ddl_transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:953:in `block in migrate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:949:in `each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:949:in `migrate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:807:in `up'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:785:in `migrate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/opt/rh/rh-ruby22/root/usr/share/ruby/monitor.rb:211:in `mon_synchronize'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/opt/rh/rh-ruby22/root/usr/bin/rake:33:in `<main>'
NoMethodError: undefined method `inject' for nil:NilClass
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/app/lib/katello/http_resource.rb:197:in `hash_to_query'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/app/lib/katello/resources/candlepin.rb:102:in `get'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/db/migrate/20150930183738_migrate_content_hosts.rb:118:in `backend_data'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/db/migrate/20150930183738_migrate_content_hosts.rb:122:in `facts'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/db/migrate/20150930183738_migrate_content_hosts.rb:212:in `block in get_systems_with_facts'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/db/migrate/20150930183738_migrate_content_hosts.rb:210:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/db/migrate/20150930183738_migrate_content_hosts.rb:210:in `get_systems_with_facts'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/db/migrate/20150930183738_migrate_content_hosts.rb:252:in `ensure_one_system_per_hostname'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc8/db/migrate/20150930183738_migrate_content_hosts.rb:313:in `up'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:598:in `exec_migration'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/opt/rh/rh-ruby22/root/usr/share/ruby/benchmark.rb:288:in `measure'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:578:in `block in migrate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:577:in `migrate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:752:in `migrate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:1038:in `block in ddl_transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:208:in `transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:1038:in `ddl_transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:953:in `block in migrate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:949:in `each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:949:in `migrate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:807:in `up'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:785:in `migrate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/opt/rh/rh-ruby22/root/usr/share/ruby/monitor.rb:211:in `mon_synchronize'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/opt/rh/rh-ruby22/root/usr/bin/rake:33:in `<main>'
Tasks: TOP => db:migrate
</pre>

<pre>
[root@pal130 ~]# rpm -qa|grep -E '(foreman|pulp|katello)' |sort
foreman-1.11.2-1.el6.noarch
foreman-compute-1.11.2-1.el6.noarch
foreman-debug-1.11.2-1.el6.noarch
foreman-gce-1.11.2-1.el6.noarch
foreman-installer-1.11.2-1.el6.noarch
foreman-installer-katello-3.0.0-10.rc8.el6.noarch
foreman-libvirt-1.11.2-1.el6.noarch
foreman-ovirt-1.11.2-1.el6.noarch
foreman-postgresql-1.11.2-1.el6.noarch
foreman-proxy-1.11.2-1.el6.noarch
foreman-release-1.11.2-1.el6.noarch
foreman-release-scl-2-1.el6.x86_64
foreman-selinux-1.11.2-1.el6.noarch
foreman-vmware-1.11.2-1.el6.noarch
katello-3.0.0-8.rc8.el6.noarch
katello.ad.pvt-apache-1.0-1.noarch
katello.ad.pvt-foreman-client-1.0-1.noarch
katello.ad.pvt-parent-cert-1.0-1.noarch
katello.ad.pvt-qpid-broker-1.0-1.noarch
katello.ad.pvt-qpid-client-cert-1.0-1.noarch
katello-certs-tools-2.4.0-1.el6.noarch
katello-client-bootstrap-1.1.0-1.el6.noarch
katello-common-3.0.0-8.rc8.el6.noarch
katello-debug-3.0.0-8.rc8.el6.noarch
katello-default-ca-1.0-1.noarch
katello-installer-base-3.0.0-10.rc8.el6.noarch
katello-repos-3.0.0-2.el6.noarch
katello-selinux-3.0.1-1.el6.noarch
katello-server-ca-1.0-1.noarch
katello-service-3.0.0-8.rc8.el6.noarch
m2crypto-0.21.1.pulp-8.el6.x86_64
mod_wsgi-3.4-2.pulp.el6.x86_64
pal130.ad.pvt-foreman-client-1.0-5.noarch
pal130.ad.pvt-foreman-proxy-1.0-5.noarch
pal130.ad.pvt-foreman-proxy-client-1.0-2.noarch
pulp-admin-client-2.8.3-1.el6.noarch
pulp-client-1.0-1.noarch
pulp-docker-plugins-2.0.1-1.el6.noarch
pulp-katello-1.0-1.el6.noarch
pulp-puppet-plugins-2.8.3-1.el6.noarch
pulp-puppet-tools-2.8.3-1.el6.noarch
pulp-rpm-admin-extensions-2.8.3-1.el6.noarch
pulp-rpm-plugins-2.8.3-1.el6.noarch
pulp-selinux-2.8.3-1.el6.noarch
pulp-server-2.8.3-1.el6.noarch
python-isodate-0.5.0-4.pulp.el6.noarch
python-kombu-3.0.33-5.pulp.el6.noarch
python-pulp-bindings-2.8.3-1.el6.noarch
python-pulp-client-lib-2.8.3-1.el6.noarch
python-pulp-common-2.8.3-1.el6.noarch
python-pulp-docker-common-2.0.1-1.el6.noarch
python-pulp-oid_validation-2.8.3-1.el6.noarch
python-pulp-puppet-common-2.8.3-1.el6.noarch
python-pulp-repoauth-2.8.3-1.el6.noarch
python-pulp-rpm-common-2.8.3-1.el6.noarch
python-pulp-streamer-2.8.3-1.el6.noarch
python-rhsm-1.8.0-2.pulp.el6.x86_64
rubygem-smart_proxy_pulp-1.2.0-1.el6.noarch
tfm-rubygem-foreman_bootdisk-7.0.1-1.fm1_11.el6.noarch
tfm-rubygem-foreman_discovery-5.0.2-1.fm1_11.el6.noarch
tfm-rubygem-foreman_docker-2.1.1-1.fm1_11.el6.noarch
tfm-rubygem-foreman_gutterball-0.0.1-3.el6.noarch
tfm-rubygem-foreman_hooks-0.3.9-2.fm1_11.el6.noarch
tfm-rubygem-foreman-tasks-0.7.17-1.fm1_11.el6.noarch
tfm-rubygem-hammer_cli_foreman-0.6.2-1.el6.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3-4.el6.noarch
tfm-rubygem-hammer_cli_foreman_docker-0.0.3-5.el6.noarch
tfm-rubygem-hammer_cli_foreman_tasks-0.0.10-1.fm1_11.el6.noarch
tfm-rubygem-hammer_cli_katello-0.0.26-1.el6.noarch
tfm-rubygem-katello-3.0.0-11.rc8.el6.noarch
</pre>

Comment 1 Justin Sherrill 2016-06-08 13:15:47 UTC
Created from redmine issue http://projects.theforeman.org/issues/15301

Comment 2 Justin Sherrill 2016-06-08 13:15:50 UTC
Upstream bug assigned to jsherril

Comment 3 Justin Sherrill 2016-06-08 13:29:32 UTC
To reproduce, prior to upgrade simply run:

s = ::Katello::System.first
s.uuid = nil
s.save!

Comment 6 jcallaha 2016-07-21 18:57:13 UTC
Verified in Satellite 6.2 Beta Snap 21.

#<Katello::System id: 1, uuid: "4b74f06b-eac9-4763-ab1b-dfb3f243a6cf", name: "qe-blade-05.idmqe.lab.eng.bos.redhat.com", description: "Initial Registration Params", location: "None", environment_id: 1, created_at: "2016-07-21 13:45:23", updated_at: "2016-07-21 13:45:25", type: "Katello::System", content_view_id: 1, host_id: nil>

then ran steps provided by justin to get

#<Katello::System id: 1, uuid: nil, name: "qe-blade-05.idmqe.lab.eng.bos.redhat.com", description: "Initial Registration Params", location: "None", environment_id: 1, created_at: "2016-07-21 13:45:23", updated_at: "2016-07-21 13:50:23", type: "Katello::System", content_view_id: 1, host_id: nil>

no issues seen during upgrade to latest 6.2 snap.

Comment 7 Bryan Kearney 2016-07-27 11:34:30 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/RHBA-2016:1501