Actions
Bug #24697
closedforeman-rake db:seed fails on upgrade to Foraman 1.17.1
Difficulty:
Triaged:
No
Bugzilla link:
Found in Releases:
Description
When upgrading our instance from 1.16.2 > 1.17.1, foreman_rake db:seed fails on 040-role.rb step with NoMethodError. I attached bookmarks, filters, roles, permissions from my database.
# 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-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block 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
Removing role.rb shows it is the only one with an error:
# mv /usr/share/foreman/db/seeds.d/040-roles.rb . # 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
Files
Actions