Foreman-rake db:seed fails on upgrade

Problem:
Upgrading from 1.16.1 to 1.17.1 fails at db:seed. Can somebody point me in the right direction? I had the same issue yesterday when tring to upgrade directly to 1.18.1

Expected outcome:

Foreman and Proxy versions:
1.16.1 > 1.17.1

Foreman and Proxy plugin versions:

Other relevant data:
[root@foreman ~]# foreman-rake db:seed --trace
/opt/theforeman/tfm/root/usr/share/gems/gems/sequel-4.20.0/lib/sequel/database/schema_generator.rb:19: warning: constant ::Fixnum is deprecated
/opt/theforeman/tfm/root/usr/share/gems/gems/sequel-4.20.0/lib/sequel/database/schema_generator.rb:19: warning: constant ::Bignum is deprecated
/usr/share/foreman/lib/core_extensions.rb:183: warning: already initialized constant ActiveSupport::MessageEncryptor::DEFAULT_CIPHER
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/message_encryptor.rb:22: warning: previous definition of DEFAULT_CIPHER was here
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
The PGconn, PGresult, and PGError constants are deprecated, and will be
removed as of version 1.0.

You should use PG::Connection, PG::Result, and PG::Error instead, respectively.

Called from /opt/theforeman/tfm/root/usr/share/gems/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:abort_if_pending_migrations
Seeding /usr/share/foreman/db/seeds.d/020-partition_tables_list.rb
Seeding /usr/share/foreman/db/seeds.d/020-permissions_list.rb
Seeding /usr/share/foreman/db/seeds.d/020-provisioning_templates_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
rake aborted!
NoMethodError: undefined method `id' for nil:NilClass
/usr/share/foreman/app/models/role.rb:324:in `block in find_current_filter'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/relation/delegation.rb:39:in `each'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/relation/delegation.rb:39:in `each'
/usr/share/foreman/app/models/role.rb:324:in `detect'
/usr/share/foreman/app/models/role.rb:324:in `find_current_filter'
/usr/share/foreman/app/models/role.rb:320:in `filter_for_permissions_remove'
/usr/share/foreman/app/models/role.rb:178:in `filters_and_filterings_for_removal'
/usr/share/foreman/app/models/role.rb:173:in `block in find_for_permission_removal'
/usr/share/foreman/app/models/role.rb:172:in `each'
/usr/share/foreman/app/models/role.rb:172:in `inject'
/usr/share/foreman/app/models/role.rb:172:in `find_for_permission_removal'
/usr/share/foreman/app/models/role.rb:211:in `remove_permissions!'
/usr/share/foreman/lib/seed_helper.rb:92:in `block in update_role_permissions'
/usr/share/foreman/app/models/role.rb:234:in `ignore_locking'
/usr/share/foreman/lib/seed_helper.rb:84:in `update_role_permissions'
/usr/share/foreman/lib/seed_helper.rb:63:in `create_role'
/usr/share/foreman/db/seeds.d/040-roles.rb:10:in `block (4 levels) in <top (required)>'
/usr/share/foreman/db/seeds.d/040-roles.rb:9:in `each'
/usr/share/foreman/db/seeds.d/040-roles.rb:9:in `block (3 levels) in <top (required)>'
/usr/share/foreman/app/models/concerns/authorizable.rb:115:in `skip_permission_check'
/usr/share/foreman/db/seeds.d/040-roles.rb:5:in `block (2 levels) in <top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.4.1/lib/audited/auditor.rb:283:in `without_auditing'
/usr/share/foreman/db/seeds.d/040-roles.rb:4:in `block in <top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.4.1/lib/audited/auditor.rb:283:in `without_auditing'
/usr/share/foreman/db/seeds.d/040-roles.rb:3: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:93:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:99: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/lib/rake/task.rb:250:in `block in execute'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/opt/rh/rh-ruby24/root/usr/share/ruby/monitor.rb:214:in `mon_synchronize'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/opt/rh/rh-ruby24/root/usr/bin/rake:23:in `load'
/opt/rh/rh-ruby24/root/usr/bin/rake:23:in `<main>'
Tasks: TOP => db:seed

The following plugins are installed:

  • foreman-tasks - 0.10.9
  • foreman_discovery - 10.0.0
  • foreman_setup - 5.0.0
  • foreman_templates - 5.0.1

db:seed runs when skipping 040-role.rb; however puppet enc is not working any more as many (or all) parameter types seem to be strings suddenly:

2018-08-22T17:43:37 95325a8c [app] [W] Failed to generate external nodes for v-s3-10.int.m-box.de
 | NoMethodError: undefined method `deep_merge!' for "{}":String
 | /usr/share/foreman/app/services/classification/values_hash_query.rb:160:in `block in update_hash_matcher'
 | /usr/share/foreman/app/services/classification/values_hash_query.rb:155:in `reverse_each'
 | /usr/share/foreman/app/services/classification/values_hash_query.rb:155:in `update_hash_matcher'
 | /usr/share/foreman/app/services/classification/values_hash_query.rb:52:in `merged_value'
 | /usr/share/foreman/app/services/classification/values_hash_query.rb:38:in `calculate_value'
 | /usr/share/foreman/app/services/classification/values_hash_query.rb:21:in `block in values_hash'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/relation/delegation.rb:39:in `each'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/relation/delegation.rb:39:in `each'
 | /usr/share/foreman/app/services/classification/values_hash_query.rb:20:in `values_hash'
 | /usr/share/foreman/app/models/concerns/classification.rb:5:in `block (2 levels) in <module:Classification>'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/scoping/named.rb:171:in `instance_exec'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/scoping/named.rb:171:in `block (2 levels) in scope'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/relation.rb:336:in `scoping'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/scoping/named.rb:171:in `block in scope'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/relation/delegation.rb:66:in `block in values_hash'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/relation.rb:336:in `scoping'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/relation/delegation.rb:66:in `values_hash'
 | /usr/share/foreman/app/models/host_info_providers/puppet_info.rb:21:in `puppetclass_parameters'
 | /usr/share/foreman/app/models/host_info_providers/puppet_info.rb:87:in `classes_info_hash'
 | /usr/share/foreman/app/models/host_info_providers/puppet_info.rb:11:in `host_info'
 | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:29:in `block in info'
 | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:27:in `each'
 | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:27:in `info'
 | /usr/share/foreman/app/controllers/hosts_controller.rb:206:in `block in externalNodes'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/mime_responds.rb:195:in `respond_to'
 | /usr/share/foreman/app/controllers/hosts_controller.rb:202:in `externalNodes'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:186:in `process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/rendering.rb:30:in `process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:108:in `block in run_callbacks'
 | /usr/share/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.4.1/lib/audited/sweeper.rb:14:in `around'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.4.1/lib/audited/sweeper.rb:14:in `around'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:135:in `run_callbacks'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:19:in `process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/rescue.rb:20:in `process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `block in instrument'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `instrument'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/railties/controller_runtime.rb:22:in `process_action'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:124:in `process'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionview-5.1.4/lib/action_view/rendering.rb:30:in `process'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal.rb:189:in `dispatch'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_controller/metal.rb:253:in `dispatch'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:31:in `serve'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `each'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `serve'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:834:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.6/lib/apipie/static_dispatcher.rb:65:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.6/lib/apipie/extractor/recorder.rb:136:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.6/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 | /usr/share/foreman/lib/middleware/catch_json_parse_errors.rb:8:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/etag.rb:25:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/conditional_get.rb:25:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/head.rb:12:in `call'
 | /usr/share/foreman/lib/middleware/session_safe_logging.rb:17:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:232:in `context'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:226:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/cookies.rb:613:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:97:in `run_callbacks'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:24:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/railties-5.1.4/lib/rails/rack/logger.rb:36:in `call_app'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/railties-5.1.4/lib/rails/rack/logger.rb:26:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 | /usr/share/foreman/lib/middleware/tagged_logging.rb:18:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/request_id.rb:25:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/method_override.rb:22:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/runtime.rb:22:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/executor.rb:12:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/sendfile.rb:111:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/secure_headers-3.4.1/lib/secure_headers/middleware.rb:12:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/railties-5.1.4/lib/rails/engine.rb:522:in `call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/urlmap.rb:68:in `block in call'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/urlmap.rb:53:in `each'
 | /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/rack-2.0.3/lib/rack/urlmap.rb:53:in `call'
 | /usr/share/passenger/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
 | /usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
 | /usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'
 | /usr/share/passenger/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'

The parameter issue is Bug #24640: 1.17 migration causes array/hash values for parameters to turn into strings with escaped quotes - Foreman which will be fixed in 1.18.2.
If you wish, you can try downloading the migration to fix it to /usr/share/foreman/db/migrate from https://github.com/theforeman/foreman/blob/develop/db/migrate/20180816134832_cast_lookup_key_values.rb and running foreman-rake db:migrate to execute it.

Thanks, @tbrisker! This was the more immanent issue as it breaks operation for me. I’ll report the db:seed issue as a bug.

1 Like

If you can, please attach to the bug the filters, roles and permissions you have defined in your database. perhaps one of them is invalid.

General question, are filters seeded in 04-role.rb? If I remove it, seed runs. because of the name, I tried to remove my custom roles one by one to no avail.

Can I assume the deprecation warnings are normal because of ror5 for now?

# foreman-rake db:seed
/opt/theforeman/tfm/root/usr/share/gems/gems/sequel-4.20.0/lib/sequel/database/schema_generator.rb:19: warning: constant ::Fixnum is deprecated
/opt/theforeman/tfm/root/usr/share/gems/gems/sequel-4.20.0/lib/sequel/database/schema_generator.rb:19: warning: constant ::Bignum is deprecated
/usr/share/foreman/lib/core_extensions.rb:183: warning: already initialized constant ActiveSupport::MessageEncryptor::DEFAULT_CIPHER
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/message_encryptor.rb:22: warning: previous definition of DEFAULT_CIPHER was here
The PGconn, PGresult, and PGError constants are deprecated, and will be
removed as of version 1.0.

You should use PG::Connection, PG::Result, and PG::Error instead, respectively.

Called from /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
Seeding /usr/share/foreman/db/seeds.d/020-partition_tables_list.rb
Seeding /usr/share/foreman/db/seeds.d/020-permissions_list.rb
Seeding /usr/share/foreman/db/seeds.d/020-provisioning_templates_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/050-taxonomies.rb
Seeding /usr/share/foreman/db/seeds.d/060-architectures.rb
Seeding /usr/share/foreman/db/seeds.d/070-provisioning_templates.rb
Seeding /usr/share/foreman/db/seeds.d/080-partition_tables.rb
Seeding /usr/share/foreman/db/seeds.d/100-installation_media.rb
Seeding /usr/share/foreman/db/seeds.d/110-smart_proxy_features.rb
Seeding /usr/share/foreman/db/seeds.d/130-compute_profiles.rb
Seeding /usr/share/foreman/db/seeds.d/150-bookmarks.rb
Seeding /usr/share/foreman/db/seeds.d/160-mail_notifications.rb
Seeding /usr/share/foreman/db/seeds.d/170-notification_blueprints.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.11.2/db/seeds.d/20-foreman_tasks_permissions.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-11.0.0/db/seeds.d/50_discovery_templates.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.11.2/db/seeds.d/60-dynflow_proxy_feature.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-11.0.0/db/seeds.d/60_discovery_proxy_feature.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.11.2/db/seeds.d/61-foreman_tasks_bookmarks.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-11.0.0/db/seeds.d/70_discovery_mail_notification.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-11.0.0/db/seeds.d/80_discovery_ui_notification.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-11.0.0/db/seeds.d/90_add_permissions_from_default_roles.rb
All seed files executed

Turns out the db:seed issue is because of a modified Default role:
https://projects.theforeman.org/issues/24697?next_issue_id=24693#note-2

I also figured it is ok to edit since it is not locked.

Thank you for the update! we will look into the issue.

For archival purposes, I hit two bugs:

1 Like

I think I figured out why the merge failed for you - you had the default value marked as omit so the migration skipped parsing it (to prevent parsing of values that were imported from puppet).

1 Like

Exactly what I am suspecting. I am doing another update trial today and hope to confirm this then.

This setup definitely works in < 1.17. Do you suppose this is a migration issue or, as I fear, a regression?

You can try removing this line from the migration and running it again - https://github.com/theforeman/foreman/pull/5977/files#diff-a3442e519641f7c86c4e98b16e8e5dffR27, or perhaps try patching the other migration prior to running the upgrade itself

You mean 20170112175131_migrate_template_to_parameters_macros.rb by the other migration? I’ll try this!

or perhaps try patching the other migration prior to running the upgrade itself

I’d like to, but running yum update and have absolutely no idea how to do this since I cannot just stop the rpm post script?

@tbrisker, good news! Tired the following:

  1. Upgrade to foreman 1.18.1; script was running to replace the patch for 20170112175131_migrate_template_to_parameters_macros.rb. It can be assumed the initial rake task ran this migration.
  2. Removing the return if obj.omit solves NoMethodError: undefined method deep_merge! for "{}":String. I few casting errors should be expected though, these had no consequence for me though. (The mapping class is from https://forge.puppet.com/puppet/autofs)
Error casting default_value ${ntp::params::preferred_servers} for #<PuppetclassLookupKey id: 16, key: "preferred_servers", created_at: "2015-05-09 17:08:12", updated_at: "2017-07-25 11:10:21", puppetclass_id: nil, default_value: "${ntp::params::preferred_servers}", path: nil, description: "", validator_type: "", validator_rule: nil, key_type: "array", override: true, required: false, merge_overrides: false, avoid_duplicates: false, omit: true, type: "PuppetclassLookupKey", merge_default: false, hidden_value: false> with error "${" is not allowed as a global variable name. near line 1: "ntp::params::preferred_servers}". Perhaps it is invalid?
Error casting default_value ${$ntp::params::restrict} for #<PuppetclassLookupKey id: 17, key: "restrict", created_at: "2015-05-09 17:08:12", updated_at: "2016-09-05 11:52:22", puppetclass_id: nil, default_value: "${$ntp::params::restrict}", path: nil, description: "", validator_type: "", validator_rule: nil, key_type: "array", override: true, required: false, merge_overrides: false, avoid_duplicates: false, omit: true, type: "PuppetclassLookupKey", merge_default: false, hidden_value: false> with error "${" is not allowed as a global variable name. near line 1: "$ntp::params::restrict}". Perhaps it is invalid?
Error casting default_value undef for #<PuppetclassLookupKey id: 2477, key: "mapfiles", created_at: "2018-06-04 14:16:55", updated_at: "2018-06-04 14:20:44", puppetclass_id: nil, default_value: "undef", path: nil, description: "", validator_type: "", validator_rule: nil, key_type: "hash", override: true, required: false, merge_overrides: false, avoid_duplicates: false, omit: true, type: "PuppetclassLookupKey", merge_default: false, hidden_value: false> with error (string):1 :: parse error on value "$end" ($end). Perhaps it is invalid?