Project

General

Profile

Bug #26344

db:seed after fails when upgrading to 1.21

Added by Emil Dragu 6 months ago. Updated 6 months ago.

Status:
Closed
Priority:
High
Assignee:
Category:
DB migrations
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Hi, after upgrading to 1.21, running foreman-rake db:seed fails with the following errors:

Seeding /usr/share/foreman/db/seeds.d/020-permissions_list.rb
Seeding /usr/share/foreman/db/seeds.d/020-roles_list.rb
Seeding /usr/share/foreman/db/seeds.d/030-auth_sources.rb
Seeding /usr/share/foreman/db/seeds.d/030-permissions.rb
Seeding /usr/share/foreman/db/seeds.d/035-admin.rb
Seeding /usr/share/foreman/db/seeds.d/040-roles.rb
Seeding /usr/share/foreman/db/seeds.d/050-taxonomies.rb
rake aborted!
ActiveRecord::HasManyThroughNestedAssociationsAreReadonly: Cannot modify association 'Location#puppetclasses' because it goes through more than one other association.
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/through_association.rb:104:in `ensure_not_nested'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/has_many_through_association.rb:132:in `delete_records'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb:400:in `remove_records'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/has_many_through_association.rb:108:in `remove_records'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb:393:in `block in delete_or_destroy'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb:136:in `block in transaction'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:257:in `transaction'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/transactions.rb:212:in `transaction'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb:135:in `transaction'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb:393:in `delete_or_destroy'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb:190:in `delete'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb:414:in `replace_records'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb:252:in `block in replace'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb:136:in `block in transaction'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:259:in `block in transaction'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:259:in `transaction'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/transactions.rb:212:in `transaction'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb:135:in `transaction'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb:252:in `replace'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb:41:in `writer'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/associations/builder/association.rb:116:in `puppetclasses='
/usr/share/foreman/db/seeds.d/050-taxonomies.rb:17:in `block (4 levels) in <top (required)>'
/usr/share/foreman/db/seeds.d/050-taxonomies.rb:16:in `each'
/usr/share/foreman/db/seeds.d/050-taxonomies.rb:16:in `block (3 levels) in <top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.7.1/lib/audited/auditor.rb:336:in `without_auditing'
/usr/share/foreman/db/seeds.d/050-taxonomies.rb:8:in `block (2 levels) in <top (required)>'
/usr/share/foreman/db/seeds.d/050-taxonomies.rb:7:in `each'
/usr/share/foreman/db/seeds.d/050-taxonomies.rb:7:in `block in <top (required)>'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:100:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:106:in `as_anonymous_admin'
/usr/share/foreman/db/seeds.d/050-taxonomies.rb:6:in `<top (required)>'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `load'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `block in load'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `load'
/usr/share/foreman/db/seeds.rb:36:in `block (2 levels) in <top (required)>'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:100:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:106:in `as_anonymous_admin'
/usr/share/foreman/db/seeds.rb:35:in `block in <top (required)>'
/usr/share/foreman/db/seeds.rb:29:in `each'
/usr/share/foreman/db/seeds.rb:29:in `<top (required)>'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `load'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `block in load'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `load'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/railties-5.2.2/lib/rails/engine.rb:551:in `load_seed'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:281:in `load_seed'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/activerecord-5.2.2/lib/active_record/railties/databases.rake:194:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby25/root/usr/local/share/gems/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'

Should puppetclasses be ignored also?

Associated revisions

Revision f94c7962 (diff)
Added by Tomer Brisker 6 months ago

Fixes #26344 - Skip nested associations during taxonomy seed (#6587)

Nested associations can't be assigned using `${association}=`.
This causes seed to fail if there are any puppetclasses in the DB and
taxonomies were disabled during upgrade from 1.20 to 1.21.

History

#1 Updated by Tomer Brisker 6 months ago

  • Target version set to 1.21.1
  • Priority changed from Normal to High
  • Assignee set to Tomer Brisker

#2 Updated by The Foreman Bot 6 months ago

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

#3 Updated by Marek Hulán 6 months ago

  • Fixed in Releases 1.22.0 added

#4 Updated by Tomer Brisker 6 months ago

  • Fixed in Releases 1.21.1 added

#5 Updated by Tomer Brisker 6 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF