Problem: Oops, we’re sorry but something went wrong The single-table inheritance mechanism failed to locate the subclass: ‘JobTemplate’. This error is raised because the column ‘type’ is reserved for storing the class in case of inheritance. Please rename this column if you didn’t intend it to be used for storing the inheritance class or overwrite Template.inheritance_column to use another column for that information.
<see logs section for more details)
Expected outcome:
Able to create the first Location on Foreman Foreman and Proxy versions:
Version 1.24.1 Foreman and Proxy plugin versions:
Version 1.24.1 Distribution and version:
Ubuntu 18.04 LTS
Version 1.24.1 Other relevant data:
ActiveRecord::SubclassNotFound
The single-table inheritance mechanism failed to locate the subclass: 'JobTemplate'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Template.inheritance_column to use another column for that information.
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:226:in `rescue in find_sti_class'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:219:in `find_sti_class'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:207:in `discriminate_class_for_record'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/persistence.rb:69:in `instantiate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in `block (2 levels) in find_by_sql'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in `block in each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in `map'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in `block in find_by_sql'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/querying.rb:51:in `find_by_sql'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:554:in `block in exec_queries'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:578:in `skip_query_cache_if_necessary'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:541:in `exec_queries'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:414:in `load'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:200:in `records'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation/delegation.rb:41:in `each'
/usr/share/foreman/app/models/taxonomy.rb:217:in `group_by'
/usr/share/foreman/app/models/taxonomy.rb:217:in `assign_default_templates'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:426:in `block in make_lambda'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:606:in `block (2 levels) in default_terminator'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:605:in `catch'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:605:in `block in default_terminator'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:199:in `block in halting'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in `block in invoke_before'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in `invoke_before'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:131:in `run_callbacks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:816:in `_run_create_callbacks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/callbacks.rb:346:in `_create_record'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/timestamp.rb:102:in `_create_record'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/persistence.rb:704:in `create_or_update'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/callbacks.rb:342:in `block in create_or_update'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:132:in `run_callbacks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:816:in `_run_save_callbacks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/callbacks.rb:342:in `create_or_update'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/persistence.rb:275:in `save'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/validations.rb:46:in `save'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:310:in `block (2 levels) in save'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:387:in `block in with_transaction_returning_status'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in `block in transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/usr/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in `transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:212:in `transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:385:in `with_transaction_returning_status'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:310:in `block in save'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:325:in `rollback_active_record_state!'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:309:in `save'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/suppressor.rb:44:in `save'
/usr/share/foreman/app/controllers/concerns/foreman/controller/taxonomies_controller.rb:52:in `create'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:194:in `process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:136:in `run_callbacks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `instrument'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:134:in `process'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionview-5.2.1/lib/action_view/rendering.rb:32:in `process'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal.rb:191:in `dispatch'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal.rb:252:in `dispatch'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:34:in `serve'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:52:in `block in serve'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `serve'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:840:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/apipie-rails-0.5.16/lib/apipie/static_dispatcher.rb:66:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/apipie-rails-0.5.16/lib/apipie/extractor/recorder.rb:137:in `call'
/usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/apipie-rails-0.5.16/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
/usr/share/foreman/lib/foreman/middleware/catch_json_parse_errors.rb:9:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.8/lib/rack/tempfile_reaper.rb:15:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.8/lib/rack/etag.rb:25:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.8/lib/rack/conditional_get.rb:38:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.8/lib/rack/head.rb:12:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
/usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.8/lib/rack/session/abstract/id.rb:259:in `context'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.8/lib/rack/session/abstract/id.rb:253:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/cookies.rb:670:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/railties-5.2.1/lib/rails/rack/logger.rb:38:in `call_app'
/usr/share/foreman/vendor/ruby/2.5.0/gems/railties-5.2.1/lib/rails/rack/logger.rb:28:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
/usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.8/lib/rack/method_override.rb:22:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.8/lib/rack/runtime.rb:22:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.8/lib/rack/sendfile.rb:111:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/secure_headers-6.1.2/lib/secure_headers/middleware.rb:11:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/railties-5.2.1/lib/rails/engine.rb:524:in `call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `public_send'
/usr/share/foreman/vendor/ruby/2.5.0/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `method_missing'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.8/lib/rack/urlmap.rb:68:in `block in call'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.8/lib/rack/urlmap.rb:53:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/rack-2.0.8/lib/rack/urlmap.rb:53:in `call'
/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:160:in `accept_and_process_next_request'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads'
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
/usr/share/foreman/vendor/ruby/2.5.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
<!-- e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc. For logs and configuration files, please use "preformatted text" from the toolbar to ensure proper formatting. -->
you can either install the plugin again, which will make it work, or you could attempt to do some database cleanup. It should be something like running the following commands in foreman-rake:
If these run successfully, you should be able to create a new location. If not please write back with the error message you’re seeing and I’ll try to help.
rake aborted!
ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass: ‘JobTemplate’. This error is raised because the column ‘type’ is reserved for storing the class in case of inheritance. Please rename this column if you didn’t intend it to be used for storing the inheritance class or overwrite Template.inheritance_column to use another column for that information.
Full logs:
templates = Template.where(type: ‘JobTemplate’)
TemplateInput.where(template: templates).delete_all
templates.delete_all
root@puppetserver:~# foreman-rake console
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
Loading production environment (Rails 5.2.1)
irb(main):001:0> Template.where(type: ‘JobTemplate’).delete_all
Traceback (most recent call last):
2: from lib/tasks/console.rake:5:in `block in <top (required)>’
1: from (irb):1
ActiveRecord::InvalidForeignKey (PG::ForeignKeyViolation: ERROR: update or delete on table “templates” violates foreign key constraint “fk_rails_62d06fbd3e” on table “remote_execution_features”)
DETAIL: Key (id)=(112) is still referenced from table “remote_execution_features”.
: DELETE FROM “templates” WHERE “templates”.“type” = $1
irb(main):002:0> Organization.destroy_all
=>
irb(main):003:0> Location.destroy_all
=>
root@puppetserver:~# foreman-rake db:seed
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
Seeding /usr/share/foreman/db/seeds.d/010-calibrate_bcrypt_cost.rb
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::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass: ‘JobTemplate’. This error is raised because the column ‘type’ is reserved for storing the class in case of inheritance. Please rename this column if you didn’t intend it to be used for storing the inheritance class or overwrite Template.inheritance_column to use another column for that information.
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:226:in rescue in find_sti_class' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:219:in find_sti_class’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:207:in discriminate_class_for_record' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/persistence.rb:69:in instantiate’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in block (2 levels) in find_by_sql' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in block in each’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in each' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in each’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in map' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in block in find_by_sql’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in instrument' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/querying.rb:51:in find_by_sql’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:554:in block in exec_queries' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:578:in skip_query_cache_if_necessary’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:541:in exec_queries' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:414:in load’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:200:in records' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation/delegation.rb:41:in each’
/usr/share/foreman/app/models/taxonomy.rb:217:in group_by' /usr/share/foreman/app/models/taxonomy.rb:217:in assign_default_templates’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:426:in block in make_lambda' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:198:in block (2 levels) in halting’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:606:in block (2 levels) in default_terminator' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:605:in catch’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:605:in block in default_terminator' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:199:in block in halting’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in block in invoke_before' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in each’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in invoke_before' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:131:in run_callbacks’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:816:in _run_create_callbacks' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/callbacks.rb:346:in _create_record’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/timestamp.rb:102:in _create_record' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/persistence.rb:704:in create_or_update’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/callbacks.rb:342:in block in create_or_update' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:132:in run_callbacks’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:816:in _run_save_callbacks' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/callbacks.rb:342:in create_or_update’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/persistence.rb:308:in save!' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/validations.rb:52:in save!’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:315:in block in save!' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:387:in block in with_transaction_returning_status’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in block in transaction' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:239:in block in within_new_transaction’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:236:in within_new_transaction' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in transaction’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:212:in transaction' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:385:in with_transaction_returning_status’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:315:in save!' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/suppressor.rb:48:in save!’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/persistence.rb:53:in create!' /usr/share/foreman/db/seeds.d/050-taxonomies.rb:10: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/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:108:in as' /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in as_anonymous_admin’
/usr/share/foreman/db/seeds.d/050-taxonomies.rb:6:in <top (required)>' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281:in load’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281:in block in load' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in load_dependency’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281: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:108:in as' /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114: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)>' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281:in load’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281:in block in load' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in load_dependency’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281:in load' /usr/share/foreman/vendor/ruby/2.5.0/gems/railties-5.2.1/lib/rails/engine.rb:551:in load_seed’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/tasks/database_tasks.rb:281:in load_seed' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:194:in block (2 levels) in <top (required)>’
Caused by:
NameError: uninitialized constant JobTemplate
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:283:in const_get' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:283:in block in constantize’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:281:in each' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:281:in inject’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:281:in constantize' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:221:in find_sti_class’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:207:in discriminate_class_for_record' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/persistence.rb:69:in instantiate’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in block (2 levels) in find_by_sql' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in block in each’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in each' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in each’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in map' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in block in find_by_sql’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in instrument' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/querying.rb:51:in find_by_sql’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:554:in block in exec_queries' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:578:in skip_query_cache_if_necessary’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:541:in exec_queries' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:414:in load’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation.rb:200:in records' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation/delegation.rb:41:in each’
/usr/share/foreman/app/models/taxonomy.rb:217:in group_by' /usr/share/foreman/app/models/taxonomy.rb:217:in assign_default_templates’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:426:in block in make_lambda' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:198:in block (2 levels) in halting’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:606:in block (2 levels) in default_terminator' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:605:in catch’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:605:in block in default_terminator' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:199:in block in halting’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in block in invoke_before' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in each’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in invoke_before' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:131:in run_callbacks’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:816:in _run_create_callbacks' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/callbacks.rb:346:in _create_record’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/timestamp.rb:102:in _create_record' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/persistence.rb:704:in create_or_update’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/callbacks.rb:342:in block in create_or_update' /usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:132:in run_callbacks’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:816:in _run_save_callbacks' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/callbacks.rb:342:in create_or_update’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/persistence.rb:308:in save!' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/validations.rb:52:in save!’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:315:in block in save!' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:387:in block in with_transaction_returning_status’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in block in transaction' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:239:in block in within_new_transaction’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:236:in within_new_transaction' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in transaction’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:212:in transaction' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:385:in with_transaction_returning_status’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:315:in save!' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/suppressor.rb:48:in save!’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/persistence.rb:53:in create!' /usr/share/foreman/db/seeds.d/050-taxonomies.rb:10: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/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:108:in as' /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in as_anonymous_admin’
/usr/share/foreman/db/seeds.d/050-taxonomies.rb:6:in <top (required)>' /usr/share/foreman/db/seeds.rb:36:in block (2 levels) 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/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)>' /usr/share/foreman/vendor/ruby/2.5.0/gems/railties-5.2.1/lib/rails/engine.rb:551:in load_seed’
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/tasks/database_tasks.rb:281:in load_seed' /usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:194:in block (2 levels) in <top (required)>’
Tasks: TOP => db:seed
(See full trace by running task with --trace)
Looks like there are some other tables that need cleaning as well…
considering this is a new installation, it might be easier to completely drop the database and recreate it.
to do so you will need to run the following commands:
The first one command might refuse to do so (it’s a protection against accidentally deleting a production database), in which case you might need to use psql to actually drop the database foreman is using (which should be defined in /etc/foreman/database.yml).
how did you install foreman? iirc the installer should correctly set up the db permissions for you. You can try rerunning the installer, it should fix that.
[SOLVED]
Bottom line: although I worked last time with the same Manual it worked now!!!
For future notice - if you get the original failure above - just
foreman-rake db:drop
And use the manual installation procedure again