Bug #19266

Foreman not starting because: Role is locked for user modifications.

Added by Sandro Emma 8 months ago. Updated about 1 month ago.

Status:Closed
Priority:High
Assigned To:Daniel Lobato Garcia
Category:Authorization
Target version:-
Difficulty:medium Bugzilla link:
Found in release:1.15.1 Pull request:https://github.com/theforeman/foreman/pull/4623
Story points-
Velocity based estimate-
Release1.15.2Release relationshipAuto

Description

We have Foreman installed on RHEL 7.3
We cannot start foreman:

Validation failed: Role is locked for user modifications. (ActiveRecord::RecordInvalid)
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/validations.rb:79:in `raise_record_invalid'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/validations.rb:43:in `save!'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:291:in `block in save!'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:220:in `transaction'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:291:in `save!'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in `each'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in `each'
  /usr/share/foreman/app/services/cache_manager.rb:13:in `create_new_filter_cache'
  /usr/share/foreman/app/services/cache_manager.rb:20:in `recache!'
  /usr/share/foreman/config/initializers/fix_cache.rb:10:in `<top (required)>'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `block in load'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/engine.rb:652:in `block in load_config_initializer'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/notifications.rb:166:in `instrument'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/engine.rb:651:in `load_config_initializer'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/engine.rb:615:in `each'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/engine.rb:615:in `block in <class:Engine>'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/initializable.rb:30:in `instance_exec'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/initializable.rb:30:in `run'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/initializable.rb:55:in `block in run_initializers'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:226:in `block in tsort_each'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:420:in `block (2 levels) in each_strongly_connected_component_from'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:429:in `each_strongly_connected_component_from'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:419:in `block in each_strongly_connected_component_from'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/initializable.rb:44:in `each'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/initializable.rb:44:in `tsort_each_child'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:413:in `call'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:413:in `each_strongly_connected_component_from'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:347:in `block in each_strongly_connected_component'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:345:in `each'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:345:in `call'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:345:in `each_strongly_connected_component'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:224:in `tsort_each'
  /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:203:in `tsort_each'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/initializable.rb:54:in `run_initializers'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/application.rb:352:in `initialize!'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/railtie.rb:194:in `public_send'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/railtie.rb:194:in `method_missing'
  /usr/share/foreman/config/environment.rb:5:in `<top (required)>'
  /opt/rh/rh-ruby22/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:54:in `require'
  /opt/rh/rh-ruby22/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:54:in `require'
  config.ru:3:in `block in <main>'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/builder.rb:55:in `instance_eval'
  /opt/rh/sclo-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/builder.rb:55:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:112:in `eval'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:112:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:158:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'
Error ID
a02be618

Related issues

Related to Foreman - Feature #18001: Allow plugins to easily add their permissions to core's V... Closed 01/10/2017
Related to Salt - Bug #20055: Salt seeds cannot run due to role locking on 1.15 New 06/20/2017
Duplicated by Foreman - Bug #20099: Passanger not starting after upgrading from 1.15.0 to 1.1... Duplicate 06/23/2017

Associated revisions

Revision ef217ff9
Added by Daniel Lobato Garcia 5 months ago

Fixes #19266 - fix_db_cache crashes Rails initialization

The Filters cache that CacheManager recreates when
fix_db_cache is true, fails when the roles associated with said
filters are locked. To generate the cache, we call `.save` on the filter
object, which is not allowed by Role.

Another issue is that some Filters may have many resource types, which
will also fail to save again to recreate the cache. This behavior is now
autofixed in the cache.

Revision c3da3dcb
Added by Daniel Lobato Garcia 5 months ago

Fixes #19266 - fix_db_cache crashes Rails initialization

The Filters cache that CacheManager recreates when
fix_db_cache is true, fails when the roles associated with said
filters are locked. To generate the cache, we call `.save` on the filter
object, which is not allowed by Role.

Another issue is that some Filters may have many resource types, which
will also fail to save again to recreate the cache. This behavior is now
autofixed in the cache.

(cherry picked from commit ef217ff9da2085311dd7080ea05ba03f473975bf)

History

#1 Updated by Dominic Cleal 8 months ago

  • Related to Feature #18001: Allow plugins to easily add their permissions to core's Viewer and Manager added

#2 Updated by Dominic Cleal 8 months ago

  • Category changed from Web Interface to Authorization
  • Release set to 1.15.0

Tentatively setting to 1.15.0 as the error message was introduced in #18001.

#3 Updated by Daniel Lobato Garcia 8 months ago

Is this a clean install on 1.15-RC1 or an upgrade from 1.14?

#4 Updated by Daniel Lobato Garcia 8 months ago

When do you see this error / where do you see it? Is it after restarting httpd (systemctl restart httpd), in /var/log/foreman/production.log?

#5 Updated by Marek Hulán 8 months ago

Also would it be possible to list plugins you have installed and their versions?

#6 Updated by Sandro Emma 8 months ago

We have foreman installed via package and upgraded from 1.14 to 1.15 so no clean install of 1.15.

We get this error when restarting httpd and we cannot access foreman Web Client.

I think this is an Issue with the DB if we create a new DB and restart Foreman everything works somehow, i'm currently working on searching the query that lets the application crash..

Last Query before foreman "crashes" :

 
SELECT `taxonomies`.id FROM `taxonomies` INNER JOIN `taxable_taxonomies` 
ON `taxonomies`.`id` = `taxable_taxonomies`.`taxonomy_id` 
WHERE `taxable_taxonomies`.`taxable_id` = 32 AND `taxable_taxonomies`.`taxable_type` = 'Filter' AND `taxonomies`.`type` = 'Location'  
ORDER BY `taxonomies`.`title` ASC;

ROLLBACK;

#7 Updated by Sandro Emma 8 months ago

Could you maybe help us out with some more detail on the database architecture ?
Like why is the Table 'foreman.taxonomies' and 'foreman.taxable_taxonomies' empty ? As those ar the last SELECT's before foreman crashes..

#8 Updated by Marek Hulán 8 months ago

These two tables are only used if you enable organizations and/or locations in settings.yaml. So they are empty because you probably didn't allow it.

#9 Updated by Sandro Emma 8 months ago

So we were able to fix this issue for now by downgrading again to 1.14 after we checked that the db seems to work again on 1.14 we upgraded again to 1.15 and it seems to work at the moment. If you want i can provide some more details..

Thanks
Sandro

#10 Updated by Daniel Lobato Garcia 8 months ago

  • Release deleted (1.15.0)

Removing the 1.15.0 release tag as it seems to work well on manual testing (1.14.3 to 1.15.0 and fresh install). Maybe it's what Marek said above about disabling orgs/locs on upgrade.

#11 Updated by Rob Sanders 6 months ago

I've got the same problem while upgrading from 1.14.1 to 1.15. Running foreman-installer --scenario katello --upgrade produces the same backtrace.

#12 Updated by Rob Sanders 6 months ago

I've got the same problem while upgrading from 1.14.1 to 1.15. Running foreman-installer --scenario katello --upgrade produces similar backtrace:

Upgrade Step: db_seed...
rake aborted!
ActiveRecord::RecordInvalid: Validation failed: Filters.role is locked for user modifications.
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/validations.rb:79:in `raise_record_invalid'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/validations.rb:43:in `save!'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:291:in `block in save!'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:220:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:291:in `save!'
/usr/share/foreman/app/models/role.rb:154:in `add_permissions!'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_salt-8.0.2/db/seeds.d/75-salt_seeds.rb:9:in `block in <top (required)>'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in `each'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_salt-8.0.2/db/seeds.d/75-salt_seeds.rb:8:in `<top (required)>'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `block in load'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
/usr/share/foreman/db/seeds.rb:38:in `block in <top (required)>'
/usr/share/foreman/db/seeds.rb:36:in `each'
/usr/share/foreman/db/seeds.rb:36:in `<top (required)>'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `block in load'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/engine.rb:547:in `load_seed'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/tasks/database_tasks.rb:250:in `load_seed'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/railties/databases.rake:183:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)
Successfully encrypted field for Setting::Auth oauth_consumer_key
Successfully decrypted field for Setting::Auth oauth_consumer_key
Successfully decrypted field for Setting::Auth oauth_consumer_key
Successfully encrypted field for Setting::Auth oauth_consumer_secret
Successfully decrypted field for Setting::Auth oauth_consumer_secret
Successfully decrypted field for Setting::Auth oauth_consumer_secret
Seeding /usr/share/foreman/db/seeds.d/02-permissions_list.rb
Seeding /usr/share/foreman/db/seeds.d/02-roles_list.rb
Seeding /usr/share/foreman/db/seeds.d/03-auth_sources.rb
Seeding /usr/share/foreman/db/seeds.d/03-permissions.rb
Seeding /usr/share/foreman/db/seeds.d/03-roles.rb
Seeding /usr/share/foreman/db/seeds.d/04-admin.rb
Seeding /usr/share/foreman/db/seeds.d/05-taxonomies.rb
Seeding /usr/share/foreman/db/seeds.d/06-architectures.rb
Seeding /usr/share/foreman/db/seeds.d/07-data.rb
Seeding /usr/share/foreman/db/seeds.d/07-provisioning_templates.rb
Seeding /usr/share/foreman/db/seeds.d/08-data.rb
Seeding /usr/share/foreman/db/seeds.d/08-partition_tables.rb
Seeding /usr/share/foreman/db/seeds.d/10-installation_media.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.0.2/db/seeds.d/101-locations.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.0.2/db/seeds.d/102-organizations.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.0.2/db/seeds.d/103-provisioning_templates.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.0.2/db/seeds.d/104-proxy.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.0.2/db/seeds.d/106-mail_notifications.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.0.2/db/seeds.d/107-enable_dynflow.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.0.2/db/seeds.d/108-subcription-bookmarks.rb
Seeding /usr/share/foreman/db/seeds.d/11-smart_proxy_features.rb
Seeding /usr/share/foreman/db/seeds.d/13-compute_profiles.rb
Seeding /usr/share/foreman/db/seeds.d/15-bookmarks.rb
Seeding /usr/share/foreman/db/seeds.d/16-mail_notifications.rb
Seeding /usr/share/foreman/db/seeds.d/17-notification_blueprints.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/db/seeds.d/20-foreman_tasks_permissions.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/db/seeds.d/60-dynflow_proxy_feature.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.3.1/db/seeds.d/60-ssh_proxy_feature.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/db/seeds.d/61-foreman_tasks_bookmarks.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-1.4.5/db/seeds.d/62_ansible_proxy_feature.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_azure-1.3.1/db/seeds.d/70-cloudapp-domain.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.3.1/db/seeds.d/70-job_templates.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.0.2/db/seeds.d/75-job_templates.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_salt-8.0.2/db/seeds.d/75-salt_seeds.rb
foreman-rake db:seed failed! Check the output for error!
Upgrade step db_seed failed. Check logs for more information.

#13 Updated by Marek Hulán 6 months ago

The problem Rob Sanders reports seems to be caused by foreman_salt not using the plugin DSL for seeding roles but rather doing it its own way - https://github.com/theforeman/foreman_salt/blob/master/db/seeds.d/75-salt_seeds.rb

#14 Updated by Marek Hulán 6 months ago

This fix for #19039 - PR https://github.com/theforeman/foreman/pull/4415 contains the fix. If we need to fix it for 1.15.z and #19039 would not be acceptable for stable branch, here's the patch that should help.

diff --git a/app/registries/foreman/plugin.rb b/app/registries/foreman/plugin.rb
index dd0e343..4e2ffc3 100644
--- a/app/registries/foreman/plugin.rb
+++ b/app/registries/foreman/plugin.rb
@@ -245,7 +245,9 @@ module Foreman #:nodoc:
       return false if pending_migrations || Rails.env.test?
       Role.transaction do
         role = Role.where(:name => name).first_or_create
-        role.add_permissions!(permissions) if role.permissions.empty?
+        role.ignore_locking do
+          role.add_permissions!(permissions) if role.permissions.empty?
+        end
         rbac_registry.role_ids << role.id
       end
     rescue PermissionMissingException => e

#15 Updated by Ido Kaplan 6 months ago

  • Found in release changed from 1.15.0 to 1.15.1

Hi,

I'm getting the same error when upgrading from "1.14.3" to "1.15.1".
It looks like that the upgrade finished successfully and foreman is running, but there is still error when running "foreman-rake db:seed".
In addition, tried to patch the file "/usr/share/foreman/app/services/foreman/plugin.rb", but still getting the same error.

Please advise.
Thanks,
Ido

Seeding /usr/share/foreman/db/seeds.d/02-permissions_list.rb
Seeding /usr/share/foreman/db/seeds.d/02-roles_list.rb
Seeding /usr/share/foreman/db/seeds.d/03-auth_sources.rb
Seeding /usr/share/foreman/db/seeds.d/03-permissions.rb
Seeding /usr/share/foreman/db/seeds.d/03-roles.rb
Seeding /usr/share/foreman/db/seeds.d/04-admin.rb
Seeding /usr/share/foreman/db/seeds.d/05-taxonomies.rb
Seeding /usr/share/foreman/db/seeds.d/06-architectures.rb
Seeding /usr/share/foreman/db/seeds.d/07-data.rb
Seeding /usr/share/foreman/db/seeds.d/07-provisioning_templates.rb
Seeding /usr/share/foreman/db/seeds.d/08-data.rb
Seeding /usr/share/foreman/db/seeds.d/08-partition_tables.rb
Seeding /usr/share/foreman/db/seeds.d/10-installation_media.rb
Seeding /usr/share/foreman/db/seeds.d/11-smart_proxy_features.rb
Seeding /usr/share/foreman/db/seeds.d/13-compute_profiles.rb
Seeding /usr/share/foreman/db/seeds.d/15-bookmarks.rb
Seeding /usr/share/foreman/db/seeds.d/16-mail_notifications.rb
Seeding /usr/share/foreman/db/seeds.d/17-notification_blueprints.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/db/seeds.d/20-foreman_tasks_permissions.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-9.0.0/db/seeds.d/50_discovery_templates.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/db/seeds.d/60-dynflow_proxy_feature.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-9.0.0/db/seeds.d/60_discovery_proxy_feature.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/db/seeds.d/61-foreman_tasks_bookmarks.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-9.0.0/db/seeds.d/70_discovery_mail_notification.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_salt-8.0.2/db/seeds.d/75-salt_seeds.rb
rake aborted!
ActiveRecord::RecordInvalid: Validation failed: Filters.role is locked for user modifications.
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/validations.rb:79:in `raise_record_invalid'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/validations.rb:43:in `save!'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:291:in `block in save!'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:220:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:291:in `save!'
/usr/share/foreman/app/models/role.rb:154:in `add_permissions!'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_salt-8.0.2/db/seeds.d/75-salt_seeds.rb:9:in `block in <top (required)>'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in `each'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_salt-8.0.2/db/seeds.d/75-salt_seeds.rb:8:in `<top (required)>'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `block in load'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
/usr/share/foreman/db/seeds.rb:38:in `block in <top (required)>'
/usr/share/foreman/db/seeds.rb:36:in `each'
/usr/share/foreman/db/seeds.rb:36:in `<top (required)>'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `block in load'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/railties-4.2.5.1/lib/rails/engine.rb:547:in `load_seed'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/tasks/database_tasks.rb:250:in `load_seed'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/railties/databases.rake:183:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)

#16 Updated by Marek Hulán 6 months ago

Ido, the patch mentioned here only works for the trace that Sandro encountered. Your (and Robs) trace is caused by the foreman_salt plugin that tries to seed permissions in non-standard way https://github.com/theforeman/foreman_salt/blob/master/db/seeds.d/75-salt_seeds.rb#L9

It should use this Foreman DSL http://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Plugin#Adding-roles

EDIT: I suggest you open issue at http://projects.theforeman.org/projects/salt

#17 Updated by Marek Hulán 6 months ago

  • Description updated (diff)

#18 Updated by Ido Kaplan 6 months ago

OK, Thanks, I have opened a ticket.

Can you please help me to understand why this error occurs since the upgrade and what is the impact of this issue?

#19 Updated by Marek Hulán 6 months ago

  • Related to Bug #20055: Salt seeds cannot run due to role locking on 1.15 added

#20 Updated by Tomer Brisker 6 months ago

  • Duplicated by Bug #20099: Passanger not starting after upgrading from 1.15.0 to 1.15.1 ( Centos 7.3 ) added

#21 Updated by Tomer Brisker 6 months ago

  • Release set to 1.15.2

Looks like the issue here is triggered by setting 'fix_db_cache' to true, as that triggers a save of all filters.
Setting as blocker for 1.15.2, as this can cause upgrade to fail and break the system.

#22 Updated by The Foreman Bot 6 months ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Daniel Lobato Garcia
  • Pull request https://github.com/theforeman/foreman/pull/4623 added

#23 Updated by Anonymous 5 months ago

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

Also available in: Atom PDF