Project

General

Profile

Bug #34661

The registration database migration could fail when the template is not available

Added by Leos Stejskal 12 months ago. Updated 10 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Host registration
Target version:
-

Related issues

Related to Foreman - Feature #31663: Usability issues with templates & operating systemsClosed

Associated revisions

Revision 73101ef9 (diff)
Added by Leos Stejskal 12 months ago

Fixes #34661 - Registration migration with nil template

Fix for the issue in registration migration,
when template might not exist while migrating the db.

See https://github.com/theforeman/foreman/pull/8256#discussion_r824099694

History

#1 Updated by Leos Stejskal 12 months ago

  • Assignee set to Leos Stejskal
  • Category set to Host registration
  • Subject changed from b'Upgrading from Satellite 6.9 to Satellite 6.10.3 fails with error "undefined method operatingsystems\' for nil:NilClass" during the db:migrate step' to Registration migration 'undefined method operatingsystems for nil:NilClass'

#2 Updated by Leos Stejskal 12 months ago

  • Subject changed from Registration migration 'undefined method operatingsystems for nil:NilClass' to Registration migration with nil template

Fix for the issue in registration migration,
when template might not exist while migrating the db.

See https://github.com/theforeman/foreman/pull/8256#discussion_r824099694

Error:

foreman-rake db:migrate --trace --verbose
'ErbParser' is ignored.
'RubyParser' is ignored.
** Invoke db:migrate (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
** Execute db:load_config
** Invoke plugin:refresh_migrations (first_time)
** Invoke environment
** Execute plugin:refresh_migrations
** Execute db:migrate
== 20210115124508 TemplateKindRegistration: migrating =========================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method operatingsystems' for nil:NilClass 
/usr/share/foreman/db/migrate/20210115124508_template_kind_registration.rb:26:in block in up'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/relation/delegation.rb:87:in each' /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/relation/delegation.rb:87:in each'
/usr/share/foreman/db/migrate/20210115124508_template_kind_registration.rb:25:in up' /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:831:in exec_migration'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:812:in block (2 levels) in migrate' /opt/rh/rh-ruby27/root/usr/share/ruby/benchmark.rb:293:in measure'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:811:in block in migrate' /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in with_connection'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:810:in migrate' /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1002:in migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1310:in block in execute_migration_in_transaction' /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1361:in block in ddl_transaction'

/opt/rh/rh-ruby27/root/usr/bin/rake:23:in `<main>'

#3 Updated by The Foreman Bot 12 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/9160 added

#4 Updated by Ondřej Ezr 12 months ago

  • Related to Feature #31663: Usability issues with templates & operating systems added

#5 Updated by The Foreman Bot 12 months ago

  • Fixed in Releases 3.3.0 added

#6 Updated by Leos Stejskal 12 months ago

  • Status changed from Ready For Testing to Closed

#7 Updated by The Foreman Bot 12 months ago

  • Pull request https://github.com/theforeman/foreman/pull/9161 added

#8 Updated by The Foreman Bot 12 months ago

  • Pull request https://github.com/theforeman/foreman/pull/9162 added

#9 Updated by The Foreman Bot 12 months ago

  • Fixed in Releases 3.2.1 added

#10 Updated by The Foreman Bot 12 months ago

  • Fixed in Releases 3.1.3 added

#11 Updated by Amit Upadhye 10 months ago

  • Subject changed from Registration migration with nil template to The registration database migration could fail when template is not available

#12 Updated by Amit Upadhye 10 months ago

  • Subject changed from The registration database migration could fail when template is not available to The registration database migration could fail when the template is not available

Also available in: Atom PDF