Project

General

Profile

Actions

Bug #30661

closed

Rake seed error on fresh installation

Added by Christian Jonak-Möchel over 4 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Hello, fresh installation fails with foreman-installer with the following error:

rake aborted!
ActiveRecord::RecordNotFound: Couldn't find JobTemplate
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/core.rb:211:in `find_by!'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_remote_execution-3.3.4/app/models/job_template.rb:152:in `block in sync_foreign_input_sets'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_remote_execution-3.3.4/app/models/job_template.rb:151:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_remote_execution-3.3.4/app/models/job_template.rb:151:in `inject'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_remote_execution-3.3.4/app/models/job_template.rb:151:in `sync_foreign_input_sets'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_remote_execution-3.3.4/app/models/job_template.rb:178:in `import_custom_data'
/usr/share/foreman/app/models/template.rb:93:in `import_without_save'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_remote_execution-3.3.4/app/models/job_template.rb:80:in `block in import_parsed'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/transactions.rb:212:in `transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_remote_execution-3.3.4/app/models/job_template.rb:73:in `import_parsed'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_remote_execution-3.3.4/app/models/job_template.rb:63:in `import_raw'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_remote_execution-3.3.4/app/models/job_template.rb:67:in `import_raw!'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_salt-13.2.4/db/seeds.d/76-job_templates.rb:21:in `block (4 levels) in <top (required)>'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_salt-13.2.4/db/seeds.d/76-job_templates.rb:19:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_salt-13.2.4/db/seeds.d/76-job_templates.rb:19:in `block (3 levels) in <top (required)>'
/usr/share/foreman/vendor/ruby/2.5.0/gems/audited-4.9.0/lib/audited/auditor.rb:376:in `without_auditing'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_salt-13.2.4/db/seeds.d/76-job_templates.rb:17:in `block (2 levels) in <top (required)>'
/usr/share/foreman/vendor/ruby/2.5.0/gems/audited-4.9.0/lib/audited/auditor.rb:376:in `without_auditing'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_salt-13.2.4/db/seeds.d/76-job_templates.rb:7:in `block in <top (required)>'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in `as_anonymous_admin'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_salt-13.2.4/db/seeds.d/76-job_templates.rb:6:in `<top (required)>'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:318:in `load'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:318:in `block in load'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:318:in `load'
/usr/share/foreman/app/services/foreman_seeder.rb:50:in `block (2 levels) in execute'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in `as_anonymous_admin'
/usr/share/foreman/app/services/foreman_seeder.rb:49:in `block in execute'
/usr/share/foreman/app/services/foreman_seeder.rb:43:in `each'
/usr/share/foreman/app/services/foreman_seeder.rb:43:in `execute'
/usr/share/foreman/db/seeds.rb:14:in `<top (required)>'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:318:in `load'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:318:in `block in load'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:318:in `load'
/usr/share/foreman/vendor/ruby/2.5.0/gems/railties-6.0.3.2/lib/rails/engine.rb:559:in `load_seed'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/tasks/database_tasks.rb:440:in `load_seed'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/railties/databases.rake:331:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)

This is due to naive importing of JobTemplates. When "salt_run_state_highstate_-_ssh_default.erb" is imported in db/seeds.d/76-job_templates.rb it references Salt Run function - SSH default, which may not be imported jet, resulting in rake db:seed failure.

Workaround is to rename or move salt_run_state_highstate-_ssh_default.erb_, so it does not get imported, then run db:seed. Afterwards it can be renamed/moved back. This time db:seed finishes successfully.

Actions

Also available in: Atom PDF