Foreman upgrade issue from 2.5.4 to 3.0.1

$ tail /var/log/foreman/production.log
2021-12-16T16:09:15 [I|app|] Rails cache backend: File
2021-12-16T16:09:17 [W|app|] Could not create role 'Discovery Manager': ERF73-0602 [Foreman::PermissionMissingException]: some permissions were not found: ["view_environments", "view_puppetclasses", :view_environments, :view_puppetclasses]
2021-12-16T16:09:17 [E|app|] Cannot continue because some permissions were not found, please run rake db:seed and retry
2021-12-16T16:09:17 [W|app|] Could not create role 'Discovery Manager': ERF73-0602 [Foreman::PermissionMissingException]: some permissions were not found: ["view_environments", "view_puppetclasses", :view_environments, :view_puppetclasses]
2021-12-16T16:09:17 [E|app|] Cannot continue because some permissions were not found, please run rake db:seed and retry
2021-12-16T16:09:19 [I|app|] Rails cache backend: File
2021-12-16T16:09:21 [W|app|] Could not create role 'Discovery Manager': ERF73-0602 [Foreman::PermissionMissingException]: some permissions were not found: ["view_environments", "view_puppetclasses", :view_environments, :view_puppetclasses]
2021-12-16T16:09:21 [E|app|] Cannot continue because some permissions were not found, please run rake db:seed and retry
2021-12-16T16:09:22 [I|app|] Rails cache backend: File
2021-12-16T16:09:22 [I|app|] Rails cache backend: File
$ foreman-rake db:seed --trace
** Invoke db:seed (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke db:load_config 
** Execute db:abort_if_pending_migrations
** Invoke dynflow:abort_if_pending_migrations (first_time)
** Invoke environment 
** Execute dynflow:abort_if_pending_migration
foreman-rake db:migrate 
```no errors

$ foreman-maintain health check --label duplicate_permission
No scenario matching label [duplicate-permission]

cc @lzap since I see these come from Discovery plugin
cc @ezr-ondrej since I see Puppet related permissions

:smiley:

1 Like

Fixed.
Commented out /usr/share/foreman/app/models/role.rb:335

  def permission_records(permissions)
    perms = permissions.flatten
    collection = Permission.where(:name => perms).all
    #if collection.size != perms.size
    #  raise ::Foreman::PermissionMissingException.new(N_("some permissions were not found: %s"),
    #    not_found_permissions(collection.pluck(:name), perms))
    #end
    collection
  end

after ran foreman-installer and it was successful
and then upgraded to version 3.1.0 without errors

2 Likes

It is fixed by https://github.com/theforeman/foreman_discovery/pull/554, and version of discovery 18.0.4.
What should be in latest 3.0 version (3.0.1)

Still appled to the most current update for me 3.9/4.11.