Project

General

Profile

Bug #23329

db:seed is failing for Ansible job templates when foreman_ansible is not installed

Added by Evgeni Golov over 3 years ago. Updated about 3 years ago.

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

Description

Hi,

commit 0715b9621669e2ada6704e8c72801585445cb9fe introduced Katello branded Ansible job templates, and now db:seed fails when foreman_ansible is not installed with:

Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0/db/seeds.d/75-job_templates.rb
rake aborted!
ActiveRecord::RecordInvalid: Validation failed: Provider type translation missing: en.activerecord.errors.models.job_template.attributes.provider_type.uniq
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/validations.rb:78:in `raise_validation_error'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/validations.rb:50:in `save!'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/attribute_methods/dirty.rb:43:in `save!'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/transactions.rb:313:in `block in save!'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/transactions.rb:384:in `block in with_transaction_returning_status'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/transactions.rb:210:in `transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/transactions.rb:381:in `with_transaction_returning_status'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/transactions.rb:313:in `save!'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/suppressor.rb:46:in `save!'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.5.0/app/models/job_template.rb:75:in `import_raw!'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0/db/seeds.d/75-job_templates.rb:8:in `block (3 levels) in <top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0/db/seeds.d/75-job_templates.rb:4:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0/db/seeds.d/75-job_templates.rb:4:in `block (2 levels) in <top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.7.0/lib/audited/auditor.rb:336:in `without_auditing'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0/db/seeds.d/75-job_templates.rb:3:in `block in <top (required)>'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:94:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:100:in `as_anonymous_admin'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0/db/seeds.d/75-job_templates.rb:2:in `<top (required)>'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
/usr/share/foreman/db/seeds.rb:38:in `block (2 levels) in <top (required)>'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:94:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:100:in `as_anonymous_admin'
/usr/share/foreman/db/seeds.rb:37:in `block in <top (required)>'
/usr/share/foreman/db/seeds.rb:31:in `each'
/usr/share/foreman/db/seeds.rb:31:in `<top (required)>'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/railties-5.1.4/lib/rails/engine.rb:549:in `load_seed'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:270:in `load_seed'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/railties/databases.rake:184:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)

Installing foreman_ansible fixes it, but Katello currently has no dependency on it (and I think that should remain like that).

Associated revisions

Revision d1a16e43 (diff)
Added by Sebastian Gräßl over 3 years ago

Fixes #23329 - Filter out Ansible templates when not required

Ansible templates require default templates to invoke, if the
foreman-ansible plugin is not present these need to be skipped.

History

#1 Updated by Evgeni Golov over 3 years ago

As pointed out by sean, this was not caught by Jenkins, because Katello only imports the templates when REX is enabled, and that is not true for CI.

https://github.com/Katello/katello/blob/b56273f715422ebaa9e9ef990d2910615a559a8c/db/seeds.d/75-job_templates.rb#L1

#2 Updated by The Foreman Bot over 3 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/7326 added

#3 Updated by Anonymous over 3 years ago

  • % Done changed from 0 to 100
  • Status changed from Ready For Testing to Closed

#4 Updated by Jonathon Turel over 3 years ago

  • Legacy Backlogs Release (now unused) set to 338

Also available in: Atom PDF