Error enabling acd

Problem:
I wanted to enable acd to have a look at it

Expected outcome:

Foreman and Proxy versions:

Foreman and Proxy plugin versions:

Distribution and version:
CentOS 8 Stream
foreman 3.2, katello 4.4

Other relevant data:

09:13:26 (PROD) root@foreman-app01-prod [~] # cat /var/log/foreman-proxy/proxy.log
2022-04-11T08:50:27 [E] Disabling all modules in the group ['acd'] due to a failure in one of them: uninitialized constant Proxy::Dynflow::Runner::Base
Did you mean? Base64
2022-04-11T08:50:27 [W] Error details for Disabling all modules in the group ['acd'] due to a failure in one of them: uninitialized constant Proxy::Dynflow::Runner::Base
Did you mean? Base64: <NameError>: uninitialized constant Proxy::Dynflow::Runner::Base
Did you mean? Base64
/usr/share/gems/gems/smart_proxy_dynflow-0.7.0/lib/smart_proxy_dynflow/runner/command_runner.rb:7:in `<module:Runner>'
/usr/share/gems/gems/smart_proxy_dynflow-0.7.0/lib/smart_proxy_dynflow/runner/command_runner.rb:6:in `<module:Dynflow>'
/usr/share/gems/gems/smart_proxy_dynflow-0.7.0/lib/smart_proxy_dynflow/runner/command_runner.rb:5:in `<top (required)>'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
/usr/share/gems/gems/smart_proxy_acd-0.3.0/lib/smart_proxy_acd/acd_runner.rb:1:in `<top (required)>'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
/usr/share/gems/gems/smart_proxy_acd-0.3.0/lib/smart_proxy_acd/acd.rb:12:in `block in <class:Plugin>'
/usr/share/foreman-proxy/lib/proxy/pluggable.rb:111:in `load_classes'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:337:in `load_classes'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:279:in `load_settings'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:263:in `load_plugin_settings'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:80:in `load_plugin_settings'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:167:in `each'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:167:in `initialize_plugins'
/usr/share/foreman-proxy/lib/launcher.rb:173:in `launch'
/usr/share/foreman-proxy/bin/smart-proxy:6:in `<main>'
2022-04-11T08:50:27 [I] Successfully initialized 'pulpcore'
2022-04-11T08:50:27 [W] Could not open DB for dynflow at '', will keep data in memory. Restart will drop all dynflow data.
2022-04-11T08:50:27 [I] Execution plan cleaner removing 0 execution plans.
2022-04-11T08:50:27 [I] Successfully initialized 'dynflow'
2022-04-11T08:50:27 [I] Successfully initialized 'ansible'
2022-04-11T08:50:27 [I] Successfully initialized 'ssh'
2022-04-11T08:50:27 [I] Successfully initialized 'discovery'
2022-04-11T08:50:27 [I] Successfully initialized 'openscap'
2022-04-11T08:50:27 [I] Successfully initialized 'foreman_proxy'
2022-04-11T08:50:27 [I] Successfully initialized 'logs'
2022-04-11T08:50:27 [I] WEBrick 1.6.1
2022-04-11T08:50:27 [I] ruby 2.7.3 (2021-04-05) [x86_64-linux]
2022-04-11T08:50:27 [I]
foreman-installer --scenario katello \
--enable-foreman-cli \
--enable-foreman-plugin-acd \
--enable-foreman-cli-ansible \
--enable-foreman-cli-discovery \
--enable-foreman-cli-tasks \
--enable-foreman-cli-templates \
--enable-foreman-cli-openscap \
--enable-foreman-compute-openstack \
--enable-foreman-compute-vmware \
--enable-foreman-plugin-ansible \
--enable-foreman-plugin-discovery \
--enable-foreman-plugin-hooks \
--enable-foreman-plugin-host-reports \
--no-enable-foreman-plugin-monitoring \
--enable-foreman-plugin-openscap \
--enable-foreman-plugin-remote-execution \
--enable-foreman-plugin-snapshot-management \
--enable-foreman-plugin-tasks \
--enable-foreman-plugin-templates \
--enable-foreman-proxy \
--enable-foreman-proxy-content \
--enable-foreman-proxy-plugin-ansible \
--enable-foreman-proxy-plugin-acd \
--enable-foreman-proxy-plugin-discovery \
--no-enable-foreman-proxy-plugin-monitoring \
--enable-foreman-proxy-plugin-openscap \
--enable-foreman-proxy-plugin-remote-execution-ssh \
--certs-country land \
--certs-state la \
--certs-city la \
--foreman-initial-organization "lalala AG" --foreman-initial-location place" \
--foreman-email-smtp-address smtp.lalala.land --foreman-initial-admin-email admin@lalala.land  

This looks like, something in dynflow is missing. What are your thoughts @aruzicka ?

There are parts of smart_proxy_dynflow which are optional and are not loaded by default. If you want to use some of the optionals like smart_proxy_acd does, then you have to explicitly require them, along with their dependencies. For example smart_proxy_ansible does it here [1].

IIRC bundler in development loads gems differently than what happens in production so those issues can be sometimes to catch before it lands in a release.

[1] - smart_proxy_ansible/ansible_runner.rb at master · theforeman/smart_proxy_ansible · GitHub

Thank you very much for your help.

@rainer_d, can you use this change and try again: Require dynflow runner base to load necessary class · ATIX-AG/smart_proxy_acd@1f0fb3d · GitHub

1 Like

Hi,

I changed the file
“/usr/share/gems/gems/smart_proxy_acd-0.3.0/lib/smart_proxy_acd/acd_runner.rb”

and then ran setup again, but it’s the a different error.

2022-04-11T08:50:27  [E] Disabling all modules in the group ['acd'] due to a failure in one of them: uninitialized constant Proxy::Dynflow::Runner::Base
Did you mean?  Base64
2022-04-11T08:50:27  [W] Error details for Disabling all modules in the group ['acd'] due to a failure in one of them: uninitialized constant Proxy::Dynflow::Runner::Base
Did you mean?  Base64: <NameError>: uninitialized constant Proxy::Dynflow::Runner::Base
Did you mean?  Base64
/usr/share/gems/gems/smart_proxy_dynflow-0.7.0/lib/smart_proxy_dynflow/runner/command_runner.rb:7:in `<module:Runner>'
/usr/share/gems/gems/smart_proxy_dynflow-0.7.0/lib/smart_proxy_dynflow/runner/command_runner.rb:6:in `<module:Dynflow>'
/usr/share/gems/gems/smart_proxy_dynflow-0.7.0/lib/smart_proxy_dynflow/runner/command_runner.rb:5:in `<top (required)>'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
/usr/share/gems/gems/smart_proxy_acd-0.3.0/lib/smart_proxy_acd/acd_runner.rb:1:in `<top (required)>'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
/usr/share/gems/gems/smart_proxy_acd-0.3.0/lib/smart_proxy_acd/acd.rb:12:in `block in <class:Plugin>'
/usr/share/foreman-proxy/lib/proxy/pluggable.rb:111:in `load_classes'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:337:in `load_classes'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:279:in `load_settings'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:263:in `load_plugin_settings'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:80:in `load_plugin_settings'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:167:in `each'
/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:167:in `initialize_plugins'
/usr/share/foreman-proxy/lib/launcher.rb:173:in `launch'
/usr/share/foreman-proxy/bin/smart-proxy:6:in `<main>'
2022-04-11T08:50:27  [I] Successfully initialized 'pulpcore'
2022-04-11T08:50:27  [W] Could not open DB for dynflow at '', will keep data in memory. Restart will drop all dynflow data.
2022-04-11T08:50:27  [I] Execution plan cleaner removing 0 execution plans.
2022-04-11T08:50:27  [I] Successfully initialized 'dynflow'
2022-04-11T08:50:27  [I] Successfully initialized 'ansible'
2022-04-11T08:50:27  [I] Successfully initialized 'ssh'
2022-04-11T08:50:27  [I] Successfully initialized 'discovery'
2022-04-11T08:50:27  [I] Successfully initialized 'openscap'
2022-04-11T08:50:27  [I] Successfully initialized 'foreman_proxy'
2022-04-11T08:50:27  [I] Successfully initialized 'logs'
2022-04-11T08:50:27  [I] WEBrick 1.6.1
2022-04-11T08:50:27  [I] ruby 2.7.3 (2021-04-05) [x86_64-linux]
2022-04-11T08:50:27  [I] 

Or rather the same error again. Difficult to see…

Can it be, that you added the line
require 'smart_proxy_dynflow/runner/base'
after
require 'smart_proxy_dynflow/runner/command_runner'

I think, its important that the base include is before the command_runner.

1 Like

No, it looks like this:

16:35:18 (PROD) root@foreman-app [~] # head /usr/share/gems/gems/smart_proxy_acd-0.3.0/lib/smart_proxy_acd/acd_runner.rb
require 'smart_proxy_dynflow/runner/base'
require 'smart_proxy_dynflow/runner/command_runner'
require 'tempfile'
require 'rest-client'
require 'tmpdir'
require 'socket'

# rubocop:disable ClassLength

module Proxy