Foreman Update 2.5.1 / foreman-rake db:seed fails

Problem:

After updating Foreman from 2.4.1 to 2.5.1 foreman-rake db:seed fails with this messages:

ActiveRecord::RecordInvalid: Validation failed: Operatingsystems can't assign operating system to Registration template

Foreman and Proxy versions:

  • Foreman 2.5.1

Distribution and version:

  • RHEL 8.3

Other relevant data:

[root@l1921022 seeds.d]# foreman-rake db:seed --trace
`/usr/share/foreman` is not writable.
Bundler will use `/tmp/bundler20210701-706844-16hx4l7706844' as your home directory temporarily.
** Invoke db:seed (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke db:load_config 
** Execute db:abort_if_pending_migrations
** Invoke dynflow:abort_if_pending_migrations (first_time)
** Invoke environment 
** Execute dynflow:abort_if_pending_migrations
User with login admin already exists, not seeding as admin.
rake aborted!
ActiveRecord::RecordInvalid: Validation failed: Operatingsystems can't assign operating system to Registration template
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/validations.rb:80:in `raise_validation_error'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/validations.rb:53:in `save!'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/transactions.rb:318:in `block in save!'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/transactions.rb:375:in `block in with_transaction_returning_status'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/database_statements.rb:278:in `transaction'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/transactions.rb:212:in `transaction'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/transactions.rb:366:in `with_transaction_returning_status'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/transactions.rb:318:in `save!'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/suppressor.rb:48:in `save!'
/usr/share/foreman/lib/seed_helper.rb:134:in `block in import_raw_template'
/usr/share/foreman/app/models/template.rb:73:in `ignore_locking'
/usr/share/foreman/lib/seed_helper.rb:134:in `import_raw_template'
/usr/share/foreman/lib/seed_helper.rb:140:in `block in import_templates'
/usr/share/foreman/lib/seed_helper.rb:139:in `each'
/usr/share/foreman/lib/seed_helper.rb:139:in `import_templates'
/usr/share/foreman/db/seeds.d/070-provisioning_templates.rb:9:in `block in <top (required)>'
/usr/share/gems/gems/audited-4.9.0/lib/audited/auditor.rb:376:in `without_auditing'
/usr/share/foreman/db/seeds.d/070-provisioning_templates.rb:2:in `<top (required)>'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:318:in `load'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:318:in `block in load'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:291:in `load_dependency'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:318:in `load'
/usr/share/foreman/app/services/foreman_seeder.rb:51:in `block (3 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:50:in `block (2 levels) in execute'
/usr/share/foreman/app/services/foreman_seeder.rb:44:in `each'
/usr/share/foreman/app/services/foreman_seeder.rb:44:in `block in execute'
/usr/share/foreman/lib/foreman/advisory_lock_manager.rb:20:in `block in with_transaction_lock'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/transactions.rb:212:in `transaction'
/usr/share/foreman/lib/foreman/advisory_lock_manager.rb:17:in `with_transaction_lock'
/usr/share/foreman/app/services/foreman_seeder.rb:38:in `execute'
/usr/share/foreman/db/seeds.rb:14:in `<top (required)>'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:318:in `load'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:318:in `block in load'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:291:in `load_dependency'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:318:in `load'
/usr/share/foreman/config/initializers/0_print_time_spent.rb:38:in `block in load'
/usr/share/foreman/config/initializers/0_print_time_spent.rb:17:in `benchmark'
/usr/share/foreman/config/initializers/0_print_time_spent.rb:38:in `load'
/usr/share/gems/gems/railties-6.0.3.7/lib/rails/engine.rb:559:in `load_seed'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/tasks/database_tasks.rb:440:in `load_seed'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/railties/databases.rake:331:in `block (2 levels) in <top (required)>'
/usr/share/gems/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute'
/usr/share/gems/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
/usr/share/gems/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
/usr/share/gems/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/usr/share/gems/gems/rake-13.0.1/lib/rake/task.rb:199:in `synchronize'
/usr/share/gems/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/share/gems/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
/usr/share/gems/gems/rake-13.0.1/lib/rake/application.rb:160:in `invoke_task'
/usr/share/gems/gems/rake-13.0.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/usr/share/gems/gems/rake-13.0.1/lib/rake/application.rb:116:in `each'
/usr/share/gems/gems/rake-13.0.1/lib/rake/application.rb:116:in `block in top_level'
/usr/share/gems/gems/rake-13.0.1/lib/rake/application.rb:125:in `run_with_threads'
/usr/share/gems/gems/rake-13.0.1/lib/rake/application.rb:110:in `top_level'
/usr/share/gems/gems/rake-13.0.1/lib/rake/application.rb:83:in `block in run'
/usr/share/gems/gems/rake-13.0.1/lib/rake/application.rb:186:in `standard_exception_handling'
/usr/share/gems/gems/rake-13.0.1/lib/rake/application.rb:80:in `run'
/usr/share/gems/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/usr/bin/rake:23:in `load'
/usr/bin/rake:23:in `<main>'
Tasks: TOP => db:seed

[root@l1921022 seeds.d]# foreman-installer
2021-07-01 17:38:35 [NOTICE] [root] Loading installer configuration. This will take some time.
2021-07-01 17:38:39 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2021-07-01 17:38:39 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
2021-07-01 17:38:46 [NOTICE] [configure] Starting system configuration.
2021-07-01 17:39:18 [NOTICE] [configure] 250 configuration steps out of 1273 steps complete.
2021-07-01 17:39:18 [NOTICE] [configure] 500 configuration steps out of 1275 steps complete.
2021-07-01 17:39:19 [NOTICE] [configure] 750 configuration steps out of 1279 steps complete.
2021-07-01 17:39:19 [NOTICE] [configure] 1000 configuration steps out of 1282 steps complete.
2021-07-01 17:40:01 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: Failed to call refresh: '/usr/sbin/foreman-rake db:seed' returned 1 instead of one of [0]
2021-07-01 17:40:01 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: '/usr/sbin/foreman-rake db:seed' returned 1 instead of one of [0]
2021-07-01 17:40:01 [NOTICE] [configure] 1250 configuration steps out of 1282 steps complete.
2021-07-01 17:40:04 [NOTICE] [configure] System configuration has finished.

  There were errors detected during install.
  Please address the errors and re-run the installer to ensure the system is properly configured.
  Failing to do so is likely to result in broken functionality.

  The full log is at /var/log/foreman-installer/foreman.log

Hi,

I found a workaround which, at least, works for me (we don’t really use the host registration feature)

It was necessary to remove all associated operating systems (“RedHat 8.3”, “SUSE Linux Enterprise Server 15 SP2”) from the template “Global Registration”. After saving the template it was possible to execute db:seed without further errors.

However, now it is not possible add these operating systems back to the template:

The following error message can be found in the production.log:

2021-07-01T21:14:22 [I|app|e719994c] Started PATCH "/templates/provisioning_templates/152-Global%20Registration" for 130.248.105.117 at 2021-07-01 21:14:22 +0200
2021-07-01T21:14:22 [I|app|e719994c] Processing by ProvisioningTemplatesController#update as HTML
2021-07-01T21:14:22 [I|app|e719994c]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"zu2z+E2Pm+tNXg0VtinXQ89Z/vHH5PEGdiQFka+K33+6TqF6c/J/ASQZHXDHshDm2ehQmEVl7padJQPAX+zsSQ==", "provisioning_template"=>{"default"=>"1", "operatingsystem_ids"=>["", "3"], "location_ids"=>["", "2", "3"], "organization_ids"=>["", "1"]}, "commit"=>"Submit", "id"=>"152-Global Registration"}
2021-07-01T21:14:22 [E|app|e719994c] Failed to save: Operatingsystems can't assign operating system to Registration template
2021-07-01T21:14:22 [I|app|e719994c]   Rendering provisioning_templates/edit.html.erb within layouts/application
2021-07-01T21:14:22 [I|app|e719994c]   Rendered provisioning_templates/_custom_tab_headers.html.erb (Duration: 3.3ms | Allocations: 5616)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered provisioning_templates/_alerts.html.erb (Duration: 6.0ms | Allocations: 6295)
2021-07-01T21:14:22 [W|app|e719994c] unknown class Trend, ignoring
2021-07-01T21:14:22 [I|app|e719994c] Backtrace for 'unknown class Trend, ignoring' error (NameError): uninitialized constant Trend
 e719994c | Did you mean?  Thread
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/inflector/methods.rb:282:in `const_get'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/inflector/methods.rb:282:in `block in constantize'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/inflector/methods.rb:280:in `each'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/inflector/methods.rb:280:in `inject'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/inflector/methods.rb:280:in `constantize'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/core_ext/string/inflections.rb:68:in `constantize'
 e719994c | /usr/share/foreman/app/models/filter.rb:85:in `get_resource_class'
 e719994c | /usr/share/foreman/app/models/permission.rb:22:in `block in with_translations'
 e719994c | /usr/share/foreman/app/models/permission.rb:22:in `map'
 e719994c | /usr/share/foreman/app/models/permission.rb:22:in `with_translations'
 e719994c | /usr/share/foreman/app/models/permission.rb:18:in `resources_with_translations'
 e719994c | /usr/share/foreman/app/views/template_inputs/_form.html.erb:8:in `block in _c1d4529f76450154f351c6e4d1d951a3'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:45:in `block in capture'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:209:in `with_output_buffer'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:45:in `capture'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/form_tag_helper.rb:584:in `field_set_tag'
 e719994c | /usr/share/foreman/app/views/template_inputs/_form.html.erb:3:in `_c1d4529f76450154f351c6e4d1d951a3'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/base.rb:274:in `_run'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/template.rb:185:in `block in render'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:182:in `instrument'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/template.rb:385:in `instrument_render_template'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/template.rb:183:in `render'
 e719994c | /usr/share/gems/gems/deface-1.5.3/lib/deface/action_view_extensions.rb:43:in `render'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/partial_renderer.rb:357:in `block in render_partial'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/abstract_renderer.rb:88:in `block in instrument'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:180:in `block in instrument'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:180:in `instrument'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/abstract_renderer.rb:87:in `instrument'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/partial_renderer.rb:346:in `render_partial'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/partial_renderer.rb:317:in `render'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/renderer.rb:65:in `render_partial_to_object'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/renderer.rb:27:in `render_to_object'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/renderer.rb:22:in `render'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/rendering_helper.rb:34:in `block in render'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/base.rb:304:in `in_rendering_context'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/rendering_helper.rb:30:in `render'
 e719994c | /usr/share/foreman/app/helpers/layout_helper.rb:221:in `block (2 levels) in new_child_fields_template'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:45:in `block in capture'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:209:in `with_output_buffer'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:45:in `capture'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/form_helper.rb:2547:in `block in fields_for_nested_model'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:45:in `block in capture'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:209:in `with_output_buffer'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:45:in `capture'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/form_helper.rb:1009:in `fields_for'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/form_helper.rb:2546:in `fields_for_nested_model'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/form_helper.rb:2532:in `block in fields_for_with_nested_attributes'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/form_helper.rb:2526:in `each'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/form_helper.rb:2526:in `fields_for_with_nested_attributes'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/form_helper.rb:2166:in `fields_for'
 e719994c | /usr/share/foreman/app/helpers/layout_helper.rb:220:in `block in new_child_fields_template'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:45:in `block in capture'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:209:in `with_output_buffer'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:45:in `capture'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/tag_helper.rb:273:in `content_tag'
 e719994c | /usr/share/foreman/app/helpers/layout_helper.rb:219:in `new_child_fields_template'
 e719994c | /usr/share/foreman/app/views/templates/_form.html.erb:84:in `block in _808cf5708aa910a1839783e585a45d11'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:45:in `block in capture'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:209:in `with_output_buffer'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/capture_helper.rb:45:in `capture'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/form_helper.rb:452:in `form_for'
 e719994c | /usr/share/foreman/app/helpers/form_helper.rb:287:in `form_for'
 e719994c | /usr/share/foreman/app/views/templates/_form.html.erb:9:in `_808cf5708aa910a1839783e585a45d11'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/base.rb:274:in `_run'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/template.rb:185:in `block in render'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:182:in `instrument'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/template.rb:385:in `instrument_render_template'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/template.rb:183:in `render'
 e719994c | /usr/share/gems/gems/deface-1.5.3/lib/deface/action_view_extensions.rb:43:in `render'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/partial_renderer.rb:357:in `block in render_partial'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/abstract_renderer.rb:88:in `block in instrument'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:180:in `block in instrument'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:180:in `instrument'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/abstract_renderer.rb:87:in `instrument'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/partial_renderer.rb:346:in `render_partial'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/partial_renderer.rb:317:in `render'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/renderer.rb:65:in `render_partial_to_object'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/renderer.rb:27:in `render_to_object'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/renderer.rb:22:in `render'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/rendering_helper.rb:34:in `block in render'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/base.rb:304:in `in_rendering_context'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/helpers/rendering_helper.rb:30:in `render'
 e719994c | /usr/share/foreman/app/views/provisioning_templates/edit.html.erb:3:in `_a7c660b99548491658337ac2a300a3c5'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/base.rb:274:in `_run'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/template.rb:185:in `block in render'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:182:in `instrument'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/template.rb:385:in `instrument_render_template'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/template.rb:183:in `render'
 e719994c | /usr/share/gems/gems/deface-1.5.3/lib/deface/action_view_extensions.rb:43:in `render'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/template_renderer.rb:58:in `block (2 levels) in render_template'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/abstract_renderer.rb:88:in `block in instrument'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:180:in `block in instrument'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:180:in `instrument'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/abstract_renderer.rb:87:in `instrument'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/template_renderer.rb:57:in `block in render_template'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/template_renderer.rb:65:in `render_with_layout'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/template_renderer.rb:56:in `render_template'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/template_renderer.rb:13:in `render'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/renderer/renderer.rb:29:in `render_to_object'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/rendering.rb:117:in `block in _render_template'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/base.rb:304:in `in_rendering_context'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/rendering.rb:116:in `_render_template'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/streaming.rb:218:in `_render_template'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/rendering.rb:103:in `render_to_body'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/rendering.rb:52:in `render_to_body'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/renderers.rb:142:in `render_to_body'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/abstract_controller/rendering.rb:25:in `render'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/rendering.rb:36:in `render'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/core_ext/benchmark.rb:14:in `block in ms'
 e719994c | /usr/share/ruby/benchmark.rb:308:in `realtime'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/core_ext/benchmark.rb:14:in `ms'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/instrumentation.rb:44:in `block in render'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
 e719994c | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/instrumentation.rb:43:in `render'
 e719994c | /usr/share/foreman/app/controllers/application_controller.rb:318:in `process_error'
 e719994c | /usr/share/foreman/app/controllers/templates_controller.rb:62:in `update'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/abstract_controller/base.rb:195:in `process_action'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/rendering.rb:30:in `process_action'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:112:in `block in run_callbacks'
 e719994c | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 e719994c | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 e719994c | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 e719994c | /usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 e719994c | /usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:139:in `run_callbacks'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/abstract_controller/callbacks.rb:41:in `process_action'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/rescue.rb:22:in `process_action'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:180:in `block in instrument'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:180:in `instrument'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
 e719994c | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/abstract_controller/base.rb:136:in `process'
 e719994c | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/rendering.rb:39:in `process'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal.rb:190:in `dispatch'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal.rb:254:in `dispatch'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/journey/router.rb:49:in `block in serve'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/journey/router.rb:32:in `each'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/journey/router.rb:32:in `serve'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/routing/route_set.rb:834:in `call'
 e719994c | /usr/share/gems/gems/apipie-dsl-2.4.0/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 e719994c | /usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/static_dispatcher.rb:66:in `call'
 e719994c | /usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/extractor/recorder.rb:137:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 e719994c | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 e719994c | /usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 e719994c | /usr/share/foreman/lib/foreman/middleware/catch_json_parse_errors.rb:9:in `call'
 e719994c | /usr/share/gems/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15:in `call'
 e719994c | /usr/share/gems/gems/rack-2.2.3/lib/rack/etag.rb:27:in `call'
 e719994c | /usr/share/gems/gems/rack-2.2.3/lib/rack/conditional_get.rb:40:in `call'
 e719994c | /usr/share/gems/gems/rack-2.2.3/lib/rack/head.rb:12:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
 e719994c | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 e719994c | /usr/share/gems/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:266:in `context'
 e719994c | /usr/share/gems/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:260:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/cookies.rb:648:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:101:in `run_callbacks'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 e719994c | /usr/share/gems/gems/railties-6.0.3.7/lib/rails/rack/logger.rb:37:in `call_app'
 e719994c | /usr/share/gems/gems/railties-6.0.3.7/lib/rails/rack/logger.rb:28:in `call'
 e719994c | /usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 e719994c | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/request_id.rb:27:in `call'
 e719994c | /usr/share/gems/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
 e719994c | /usr/share/gems/gems/rack-2.2.3/lib/rack/runtime.rb:22:in `call'
 e719994c | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/executor.rb:14:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 e719994c | /usr/share/gems/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call'
 e719994c | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/host_authorization.rb:76:in `call'
 e719994c | /usr/share/gems/gems/secure_headers-6.3.0/lib/secure_headers/middleware.rb:11:in `call'
 e719994c | /usr/share/gems/gems/railties-6.0.3.7/lib/rails/engine.rb:527:in `call'
 e719994c | /usr/share/gems/gems/railties-6.0.3.7/lib/rails/railtie.rb:190:in `public_send'
 e719994c | /usr/share/gems/gems/railties-6.0.3.7/lib/rails/railtie.rb:190:in `method_missing'
 e719994c | /usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:74:in `block in call'
 e719994c | /usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `each'
 e719994c | /usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `call'
 e719994c | /usr/share/gems/gems/puma-5.3.2/lib/puma/configuration.rb:249:in `call'
 e719994c | /usr/share/gems/gems/puma-5.3.2/lib/puma/request.rb:77:in `block in handle_request'
 e719994c | /usr/share/gems/gems/puma-5.3.2/lib/puma/thread_pool.rb:338:in `with_force_shutdown'
 e719994c | /usr/share/gems/gems/puma-5.3.2/lib/puma/request.rb:76:in `handle_request'
 e719994c | /usr/share/gems/gems/puma-5.3.2/lib/puma/server.rb:438:in `process_client'
 e719994c | /usr/share/gems/gems/puma-5.3.2/lib/puma/thread_pool.rb:145:in `block in spawn_thread'
 e719994c | /usr/share/gems/gems/logging-2.3.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2021-07-01T21:14:22 [I|app|e719994c]   Rendered template_inputs/_form.html.erb (Duration: 20.0ms | Allocations: 17096)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered templates/_history.html.erb (Duration: 3.8ms | Allocations: 5700)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered templates/_help_accordion.html.erb (Duration: 3.2ms | Allocations: 5633)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered templates/_help_accordion.html.erb (Duration: 2.9ms | Allocations: 5643)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered templates/_help_accordion.html.erb (Duration: 2.7ms | Allocations: 5643)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered templates/_help_accordion.html.erb (Duration: 2.8ms | Allocations: 5633)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered templates/_help_accordion.html.erb (Duration: 2.8ms | Allocations: 5643)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered templates/_help_accordion.html.erb (Duration: 3.1ms | Allocations: 5643)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered templates/_help_accordion.html.erb (Duration: 2.9ms | Allocations: 5643)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered templates/_help_accordion.html.erb (Duration: 3.2ms | Allocations: 5633)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered templates/_help_accordion.html.erb (Duration: 3.0ms | Allocations: 5629)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered provisioning_templates/_combination.html.erb (Duration: 6.0ms | Allocations: 7020)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered provisioning_templates/_combinations.html.erb (Duration: 10.3ms | Allocations: 13205)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered provisioning_templates/_custom_tabs.html.erb (Duration: 19.0ms | Allocations: 22191)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered taxonomies/_loc_org_tabs.html.erb (Duration: 10.1ms | Allocations: 8124)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered templates/_form.html.erb (Duration: 102.4ms | Allocations: 125707)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered provisioning_templates/edit.html.erb within layouts/application (Duration: 107.9ms | Allocations: 131633)
2021-07-01T21:14:22 [I|app|e719994c]   Rendered layouts/_application_content.html.erb (Duration: 2.9ms | Allocations: 5677)
2021-07-01T21:14:22 [I|app|e719994c]   Rendering layouts/base.html.erb
2021-07-01T21:14:22 [I|app|e719994c]   Rendered layouts/base.html.erb (Duration: 23.3ms | Allocations: 22787)
2021-07-01T21:14:22 [I|app|e719994c] Completed 200 OK in 195ms (Views: 133.0ms | ActiveRecord: 11.6ms | Allocations: 186722)

Cheers,
Martin

cc @lstejskal perhaps he has some ideas, I’m not sure why Registration template couldn’t be assigned without disassociating first.

I can confirm that it is a valid issue,
migration file [0] should remove any assigned OS to registration template. I’ll work on the fix ASAP

[0] foreman/20210115124508_template_kind_registration.rb at develop · theforeman/foreman · GitHub

FIX: refs #31663 Unassign OS from registration templates by stejskalleos · Pull Request #8645 · theforeman/foreman · GitHub

1 Like