Foreman puppet modules - "Rubocop not loaded" in Foreman_config_entry

Problem:
After upgrading to 1.24.3 and utilizing the puppet module(s) to configure my environment - the code is constantly “active” attempting to change various Foreman_config_entry values due to an erroeous string about “rubocop not being loaded” in the output.

I feel like i need to “install rubocop” or something (how?)? Unsure why this popped up after the upgrade though…

Expected outcome:
There should be no change - configs are static

Foreman and Proxy versions:
Foreman 1.24.3
Puppet Module Versions:
apache: 4.1.0
foreman: 13.1.0
foreman_proxy: 12.1.0
puppet: 13.0.0

Foreman and Proxy plugin versions:

Distribution and version:

Other relevant data:
[jlang1@myforemanserver~]$ sudo puppet agent -t
Info: Using configured environment ‘production’
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for myforemanpm.myfqdn.com
Info: Applying configuration version ‘myforemanserver.myfqdn.com-7954889’
Notice: /Stage[main]/Foreman::Settings/Foreman_config_entry[delivery_method]/value: value changed “Rubocop not loaded.\nsmtp” to ‘smtp’ (corrective)
Notice: /Stage[main]/Foreman::Settings/Foreman_config_entry[smtp_address]/value: value changed “Rubocop not loaded.\nsmtp.myfqdn.com” to ‘smtp.myfqdn.com’ (corrective)
Notice: /Stage[main]/Foreman::Settings/Foreman_config_entry[smtp_port]/value: value changed “Rubocop not loaded.\n25” to ‘25’ (corrective)
Notice: /Stage[main]/Foreman::Settings/Foreman_config_entry[smtp_domain]/value: value changed “Rubocop not loaded.\nmydomain.com” to ‘mydomain.com’ (corrective)
Notice: /Stage[main]/Foreman::Settings/Foreman_config_entry[smtp_authentication]/value: value changed “Rubocop not loaded.\n” to ‘’ (corrective)
Notice: Applied catalog in 182.40 seconds
[jlang1@myforemanserver~]$

How did you install Foreman? RPM? Deb? Other?

Normally there shouldn’t be a requirement on Rubocop so that surprises me. If it’s packages, can you run grep /usr/share/foreman/Gemfile* /usr/share/foreman/bundler.d/*.rb to see if it’s any of those?

You can also run foreman-rake config. Perhaps you get a more complete traceback.

Hey @ekohl

Foreman 1.24.3 is installed from the RPM based Repositories on a RHEL 7.9 machine

foreman-rake config spits out the same “rubocop” message followed by a stack trace error…
[root@fmnapprw9 ~]# foreman-rake config
Rubocop not loaded.
rake aborted!
ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass: ‘Setting::Monitoring’. This error is raised because the column ‘category’ is reserved for storing the class in case of inheritance. Please rename this column if you didn’t intend it to be used for storing the inheritance class or overwrite Setting.inheritance_column to use another column for that information.
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:226:in rescue in find_sti_class' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:219:in find_sti_class’
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:207:in discriminate_class_for_record' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/persistence.rb:69:in instantiate’
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in block (2 levels) in find_by_sql' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in block in each’
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in each' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in each’
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in map' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in block in find_by_sql’
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in instrument' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/querying.rb:51:in find_by_sql’
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation.rb:554:in block in exec_queries' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation.rb:578:in skip_query_cache_if_necessary’
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation.rb:541:in exec_queries' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation.rb:414:in load’
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation.rb:200:in records' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation/delegation.rb:41:in each’
/usr/share/foreman/lib/tasks/config.rake:117:in run_all' /usr/share/foreman/lib/tasks/config.rake:79:in run’
/usr/share/foreman/lib/tasks/config.rake:167:in block in <top (required)>' /opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/exe/rake:27:in <top (required)>’

Caused by:
NameError: uninitialized constant Setting::Monitoring
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_hooks-0.3.16/lib/foreman_hooks/as_dependencies_hook.rb:4:in `load_missing_constant'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:285:in `const_get'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:285:in `block in constantize'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:281:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:281:in `inject'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:281:in `constantize'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:221:in `find_sti_class'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:207:in `discriminate_class_for_record'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/persistence.rb:69:in `instantiate'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in `block (2 levels) in find_by_sql'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in `block in each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/result.rb:57:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in `map'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/querying.rb:52:in `block in find_by_sql'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/querying.rb:51:in `find_by_sql'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation.rb:554:in `block in exec_queries'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation.rb:578:in `skip_query_cache_if_necessary'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation.rb:541:in `exec_queries'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation.rb:414:in `load'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation.rb:200:in `records'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation/delegation.rb:41:in `each'
/usr/share/foreman/lib/tasks/config.rake:117:in `run_all'
/usr/share/foreman/lib/tasks/config.rake:79:in `run'
/usr/share/foreman/lib/tasks/config.rake:167:in `block in <top (required)>'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => config
(See full trace by running task with --trace)

The Grep command mentioned returns “nothing” from what i see:
[root@fmnapprw9 foreman]# grep /usr/share/foreman/Gemfile* /usr/share/foreman/bundler.d/*.rb
[root@fmnapprw9 foreman]#

Playing around in my lab environment - im pretty sure my root issue is that the “Monitoring” plugin is installed in some nodes in my cluster - but not others.

Working on normalizing that - but in my lab i was able to “make the problem happen” by removing the plugin from 1 or more nodes, and “fix” it by reinstalling the plugin on all nodes.

so - pebcak error.

Interesting “symptoms” - my guess is it goes back to the “foreman-rake config” command erroring as a result

Thanks for the direction/suggestion to get me looking in the right direction!

foreman_config_entry wraps foreman-rake config so if that doesn’t work well, things break unreliably. Ideally it would log those to stderr so the parsing isn’t broken but looks like that isn’t exactly the case.