Bug 1351997 - Upgrade fails during migration with undefined method update_attributes
Summary: Upgrade fails during migration with undefined method update_attributes
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Installation
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: Eric Helms
QA Contact: Sachin Ghai
URL:
Whiteboard:
Depends On:
Blocks: 1335807
TreeView+ depends on / blocked
 
Reported: 2016-07-01 11:10 UTC by Eric Helms
Modified: 2019-09-26 17:31 UTC (History)
3 users (show)

Fixed In Version: rubygem-katello-3.0.0.57-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 11:26:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Script for generating reproducer data (836 bytes, application/x-ruby)
2016-07-02 01:51 UTC, Eric Helms
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 15269 0 High Closed Katello 3.0 RC5 Upgrade fail 2020-03-13 17:06:52 UTC

Description Eric Helms 2016-07-01 11:10:39 UTC
Well i try again to upgrade my production instance from 2.4.2 to katello 3.0 RC5 but unfortunately fail  

1.-First the rake db:migrate on installation fail also found this

 katello.log 
DEBUG 2016-06-03 00:40:02 main] Hook /usr/share/katello-installer-base/hooks/post/30-upgrade.rb returned nil
[ INFO 2016-06-03 00:40:02 main] All hooks in group post finished
[DEBUG 2016-06-03 00:40:02 main] Exit with status code: 6 (signal was 6)
[ERROR 2016-06-03 00:40:02 main] Errors encountered during run:
[ERROR 2016-06-03 00:40:02 main] rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method `description=' for nil:NilClass/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc7/db/migrate/20160222143432_move_system_description_to_host.rb:14:in `block in up'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:52:in `block (2 levels) in find_each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:52:in `each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:52:in `block in find_each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:125:in `find_in_batches'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:51:in `find_each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/querying.rb:9:in `find_each'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc7/db/migrate/20160222143432_move_system_description_to_host.rb:13: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-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)>'
NoMethodError: undefined method `description=' for nil:NilClass
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc7/db/migrate/20160222143432_move_system_description_to_host.rb:14:in `block in up'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:52:in `block (2 levels) in find_each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:52:in `each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:52:in `block in find_each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:125:in `find_in_batches'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:51:in `find_each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/querying.rb:9:in `find_each'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc7/db/migrate/20160222143432_move_system_description_to_host.rb:13: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-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)>'
Tasks: TOP => db:migrate




2.- all my content hosts are unsubscribe and when try to subscribe got the following 

[root@ansible ~]# subscription-manager register --org="Verifone" --activationkey="Centos 6 Base OS" 
undefined method `unlimited_hosts' for #<Katello::ActivationKey:0x007fa5d88e8958>

Attach foreman-debug for analysis

Comment 1 Eric Helms 2016-07-01 11:10:43 UTC
Created from redmine issue http://projects.theforeman.org/issues/15269

Comment 2 Eric Helms 2016-07-01 11:10:48 UTC
Upstream bug assigned to ehelms

Comment 3 Eric Helms 2016-07-01 11:14:00 UTC
This is an upgrade issue reported by some users when upgrading to 3.0 from a 2.4 of Katello. This does not affect all users and has not been replicated by engineering but has been encountered by 3 upstream users. I will provide further information and a verification scenario once we are able to figure out the root cause of the issue. This will hopefully be done by getting hold of a helpful users 2.4 database that encountered the issue on upgrade so that we have a replication scenario.

Comment 5 Bryan Kearney 2016-07-01 18:17:20 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/15269 has been closed

Comment 6 Eric Helms 2016-07-02 01:51:54 UTC
Created attachment 1175163 [details]
Script for generating reproducer data

Comment 7 Eric Helms 2016-07-02 01:55:05 UTC
To reproduce:

 1) Install Satellite 6.1
 2) Download test data generation script to Satellite 6.1 box
 3) If your password is not 'changeme', edit test script and replace changeme with your password
 4) Ensure script is executable (chmod +x)
 5) Run script
 6) Upgrade to Satellite 6.2 Snap 18.1 or less

The test data script will generate a variety of fake system objects that are randomized in order to achieve the necessary conditions to enter the reproducer state. 

To verify:

 1) Install Satellite 6.1
 2) Download test data generation script to Satellite 6.1 box
 3) If your password is not 'changeme', edit test script and replace changeme with your password
 4) Ensure script is executable (chmod +x)
 5) Run script
 6) Upgrade to Satellite 6.2 Snap 19 or greater

Comment 8 Sachin Ghai 2016-07-04 08:35:21 UTC
Thanks Eric, with given script in comment6, I'm able o reproduce the issue:

==> /var/log/foreman-installer/satellite.log <==
[ERROR 2016-07-04 04:23:55 main] rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method `update_attribute' for nil:NilClass/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.54/db/migrate/20160222143432_move_system_description_to_host.rb:14:in `block in up'

Comment 9 Sachin Ghai 2016-07-13 12:26:03 UTC
Verified with sat62 GA snap19.1.

I ran the test script attached in comment7 and ran upgrade on 6.1.9. I didn't find issue reported in bz description. upgrade was completed successfully.

 ~]# satellite-installer --scenario satellite --upgrade
Upgrading...
Upgrade Step: stop_services...
Upgrade Step: start_databases...
Upgrade Step: update_http_conf...
Upgrade Step: migrate_pulp...
Upgrade Step: fix_pulp_httpd_conf...
Upgrade Step: start_httpd...
Upgrade Step: start_qpidd...
Upgrade Step: start_pulp...
Upgrade Step: migrate_candlepin...
Upgrade Step: start_tomcat...
Upgrade Step: fix_katello_settings_file...
Upgrade Step: migrate_foreman...
Upgrade Step: remove_nodes_distributors...
Upgrade Step: Running installer...
Installing             Done                                               [100%] [..................................................................]
  The full log is at /var/log/foreman-installer/satellite.log
Upgrade Step: restart_services...
Upgrade Step: db_seed...
Upgrade Step: import_package_groups (this may take a while) ...
Upgrade Step: import_rpms (this may take a while) ...
Upgrade Step: import_distributions (this may take a while) ...
Upgrade Step: import_puppet_modules (this may take a while) ...
Upgrade Step: import_subscriptions (this may take a while) ...
Upgrade Step: elasticsearch_message...
Elasticsearch has been removed as a dependency.  The database files can be removed manually with #rm -rf /var/lib/elasticsearch.  Some packages are no longer needed and can be removed:  #rpm -e ruby193-rubygem-tire tfm-rubygem-tire elasticsearch sigar-java sigar snappy-java lucene4-contrib lucene4
Upgrade Step: add_export_distributor (this may take a while) ...
Upgrade Step: remove_docker_v1_content (this may take a while) ...
Upgrade Step: update_puppet_repository_distributors (this may take a while) ...
Upgrade Step: update_subscription_facet_backend_data (this may take a while) ...
Upgrade Step: remove_gutterball...
Satellite upgrade completed!


one error I found in logs at step: add_export_distributor step. Will file another issue for this.

Jul 13 08:11:21 qe-sat6-upgrade-rhel7 pulp: celery.worker.job:ERROR: (22429-15584) Task pulp.server.tasks.repository.distributor_update[8bd224ce-1ff8-478d-beae-34762d45e959] raised unexpected: KeyError(u'repo-registry-id',)

Comment 10 Bryan Kearney 2016-07-27 11:26:17 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


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