Bug 1889320 - Installer fails with NoMethodError: undefined method `permissions' for nil:NilClass
Summary: Installer fails with NoMethodError: undefined method `permissions' for nil:Ni...
Keywords:
Status: POST
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Infrastructure
Version: 6.8.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Lukas Pramuk
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-10-19 11:32 UTC by Lukas Pramuk
Modified: 2020-11-30 15:31 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1890923 (view as bug list)
Environment:
Last Closed:
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 31345 High Closed Installer fails with NoMethodError: undefined method `permissions' for nil:NilClass 2020-11-30 15:31:23 UTC

Description Lukas Pramuk 2020-10-19 11:32:51 UTC
This bug was initially created as a copy of Bug #1882276

I am copying this bug because: 
There is another issue with the same symptom but different cause 


Description of problem:
Satellite-installer fails at execution of '/usr/sbin/foreman-rake -- config -k 'remote_execution_cockpit_url' -v '/webcon/=%{host}''

Version-Release number of selected component (if applicable):
Satellite 6.8.0 Snap18 (upto Snap17 there was Bug #1882276) 

How reproducible:
intermittent

Steps to Reproduce:
1. Try installing satellite with cockpit enabled

Actual results:
Fails at Execution of '/usr/sbin/foreman-rake -- config -k 'remote_execution_cockpit_url' -v '/webcon/=%{host}'' returned 1: rake aborted!

Expected results:
Satellite 6.8.0 installed successfully.

Additional info:
deep down the traceback is a bit different now:

 /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-16.1.2/lib/foreman_discovery/engine.rb:152:in `block (2 levels) in <class:Engine>'

vs.

 /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-4.0.3/lib/foreman_openscap/engine.rb:127:in `block (2 levels) in <class:Engine>'

Comment 2 Lukas Pramuk 2020-10-19 11:44:39 UTC
New traceback: 

[ERROR 2020-10-15T11:38:35 verbose]  Execution of '/usr/sbin/foreman-rake -- config -k 'remote_execution_cockpit_url' -v '/webcon/=%{host}'' returned 1: rake aborted!
[ERROR 2020-10-15T11:38:35 verbose] NoMethodError: undefined method `permissions' for nil:NilClass
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/models/role.rb:161:in `block (2 levels) in add_permissions'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/models/role.rb:160:in `each'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/models/role.rb:160:in `block in add_permissions'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/models/role.rb:157:in `each'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/models/role.rb:157:in `add_permissions'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/models/role.rb:207:in `add_permissions!'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/services/foreman/plugin/role_lock.rb:54:in `block in update_plugin_role_permissions'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/models/role.rb:86:in `ignore_locking'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/services/foreman/plugin/role_lock.rb:52:in `update_plugin_role_permissions'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/services/foreman/plugin/role_lock.rb:23:in `process_role'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/services/foreman/plugin/role_lock.rb:12:in `block in register_role'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in `as_anonymous_admin'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/services/foreman/plugin/role_lock.rb:11:in `register_role'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/registries/foreman/plugin.rb:302:in `block (2 levels) in role'
[ERROR 2020-10-15T11:38:35 verbose] /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/auditor.rb:376:in `without_auditing'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/registries/foreman/plugin.rb:301:in `block in role'
[ERROR 2020-10-15T11:38:35 verbose] /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/auditor.rb:376:in `without_auditing'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/registries/foreman/plugin.rb:300:in `role'
[ERROR 2020-10-15T11:38:35 verbose] /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-16.1.2/lib/foreman_discovery/engine.rb:152:in `block (2 levels) in <class:Engine>'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/registries/foreman/plugin.rb:78:in `instance_eval'
[ERROR 2020-10-15T11:38:35 verbose] /usr/share/foreman/app/registries/foreman/plugin.rb:78:in `register'
[ERROR 2020-10-15T11:38:35 verbose] /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-16.1.2/lib/foreman_discovery/engine.rb:45:in `block in <class:Engine>'


Former (fixed) traceback:

[ERROR 2020-09-23T13:10:59 verbose]  Execution of '/usr/sbin/foreman-rake -- config -k 'remote_execution_cockpit_url' -v '/webcon/=%{host}'' returned 1: rake aborted!
[ERROR 2020-09-23T13:10:59 verbose] NoMethodError: undefined method `permissions' for nil:NilClass
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/models/role.rb:161:in `block (2 levels) in add_permissions'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/models/role.rb:160:in `each'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/models/role.rb:160:in `block in add_permissions'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/models/role.rb:157:in `each'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/models/role.rb:157:in `add_permissions'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/models/role.rb:207:in `add_permissions!'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/services/foreman/plugin/role_lock.rb:54:in `block in update_plugin_role_permissions'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/models/role.rb:86:in `ignore_locking'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/services/foreman/plugin/role_lock.rb:52:in `update_plugin_role_permissions'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/services/foreman/plugin/role_lock.rb:23:in `process_role'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/services/foreman/plugin/role_lock.rb:12:in `block in register_role'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in `as_anonymous_admin'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/services/foreman/plugin/role_lock.rb:11:in `register_role'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/registries/foreman/plugin.rb:302:in `block (2 levels) in role'
[ERROR 2020-09-23T13:10:59 verbose] /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/auditor.rb:376:in `without_auditing'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/registries/foreman/plugin.rb:301:in `block in role'
[ERROR 2020-09-23T13:10:59 verbose] /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/auditor.rb:376:in `without_auditing'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/registries/foreman/plugin.rb:300:in `role'
[ERROR 2020-09-23T13:10:59 verbose] /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-4.0.3/lib/foreman_openscap/engine.rb:127:in `block (2 levels) in <class:Engine>'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/registries/foreman/plugin.rb:78:in `instance_eval'
[ERROR 2020-09-23T13:10:59 verbose] /usr/share/foreman/app/registries/foreman/plugin.rb:78:in `register'
[ERROR 2020-09-23T13:10:59 verbose] /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-4.0.3/lib/foreman_openscap/engine.rb:49:in `block in <class:Engine>'

Comment 3 Tomer Brisker 2020-10-20 12:57:59 UTC
This may possibly be fixed by https://projects.theforeman.org/issues/30821. 
Additionally, it isn't specific to cockpit, in fact the stack trace points at discovery in this case, updating the title accordingly.
Most likely the rake task is running before the migrations finished and the db fully seeded, which causes the plugins to expect roles to already be there.

Comment 4 Evgeni Golov 2020-10-30 10:27:46 UTC
(In reply to Tomer Brisker from comment #3)
> This may possibly be fixed by https://projects.theforeman.org/issues/30821. 
> Additionally, it isn't specific to cockpit, in fact the stack trace points
> at discovery in this case, updating the title accordingly.
> Most likely the rake task is running before the migrations finished and the
> db fully seeded, which causes the plugins to expect roles to already be
> there.

I've seen this on 2.2/6.9 based installs too :(


Note You need to log in before you can comment on or make changes to this bug.