Hammer job-invocation command not found

Problem:
while running hammer command getting below error message
“Warning: An error occured while loading module hammer_cli_foreman_remote_execution.”
also while trying to run “hammer job-invocation --help” system is not unable to find the job-invocation command.
Expected outcome:
it should provide job-invocation output
Foreman and Proxy versions:
Foreman version : 2.0.3
Foreman Proxy Version : 2.0.3
Foreman and Proxy plugin versions:

Distribution and version:
CentOS 7 (7.9.2009)
Other relevant data:
below is the logs we have from hammer -d
“[ WARN 2022-05-23T09:15:16 HammerCLIForemanOpenscap::ScapContentProfile] Resource ‘scap_content_profiles’ does not exist in the API
[ INFO 2022-05-23T09:15:16 Modules] Extension module hammer_cli_foreman_openscap (0.1.12) loaded.
[ WARN 2022-05-23T09:15:16 HammerCLIForemanRemoteExecution::JobInvocation] Resource ‘job_invocations’ does not exist in the API
[ERROR 2022-05-23T09:15:16 Modules] Error while loading module hammer_cli_foreman_remote_execution.
Warning: An error occured while loading module hammer_cli_foreman_remote_execution.
[ERROR 2022-05-23T09:15:16 Modules] undefined method action' for nil:NilClass /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_remote_execution-0.2.1/lib/hammer_cli_foreman_remote_execution/job_invocation.rb:7:in create_option_builder’
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.4.0/lib/hammer_cli/abstract.rb:184:in option_builder' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.4.0/lib/hammer_cli/abstract.rb:191:in build_options’
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-2.4.0/lib/hammer_cli_foreman/commands.rb:133:in build_options' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_remote_execution-0.2.1/lib/hammer_cli_foreman_remote_execution/job_invocation.rb:81:in class:InfoCommand
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_remote_execution-0.2.1/lib/hammer_cli_foreman_remote_execution/job_invocation.rb:38:in <class:JobInvocation>' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_remote_execution-0.2.1/lib/hammer_cli_foreman_remote_execution/job_invocation.rb:2:in module:HammerCLIForemanRemoteExecution
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_remote_execution-0.2.1/lib/hammer_cli_foreman_remote_execution/job_invocation.rb:1:in <top (required)>' /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in require’
/opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in require' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_remote_execution-0.2.1/lib/hammer_cli_foreman_remote_execution.rb:7:in module:HammerCLIForemanRemoteExecution
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_remote_execution-0.2.1/lib/hammer_cli_foreman_remote_execution.rb:5:in <top (required)>' /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:135:in require’
/opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:135:in rescue in require' /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:39:in require’
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.4.0/lib/hammer_cli/modules.rb:75:in require_module' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.4.0/lib/hammer_cli/modules.rb:54:in load!’
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.4.0/lib/hammer_cli/modules.rb:69:in load' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.4.0/lib/hammer_cli/modules.rb:80:in block in load_all’
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.4.0/lib/hammer_cli/modules.rb:79:in each' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.4.0/lib/hammer_cli/modules.rb:79:in load_all’
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.4.0/bin/hammer:134:in <top (required)>' /usr/bin/hammer:23:in load’
/usr/bin/hammer:23:in <main>' --- Caused by --- <LoadError> cannot load such file -- hammer_cli_foreman_remote_execution /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in require’
/opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in require' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.4.0/lib/hammer_cli/modules.rb:75:in require_module’
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.4.0/lib/hammer_cli/modules.rb:54:in load!' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-2.4.0/lib/hammer_cli/modules.rb:69:in load’
[ WARN 2022-05-23T09:15:16 HammerCLIForemanTemplates::ImportCommand] Resource ‘templates’ does not exist in the API
[ WARN 2022-05-23T09:15:16 HammerCLIForemanTemplates::ExportCommand] Resource ‘templates’ does not exist in the API
[ INFO 2022-05-23T09:15:16 Modules] Extension module hammer_cli_foreman_templates (0.2.0) loaded.
[DEBUG 2022-05-23T09:15:16 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Added predefined options for HammerCLIForeman::SmartProxy::ImportPuppetClassesCommand:”

@iballou - during last week’s demo, i think i remember seeing this error in your environment. Any idea why?

strange thing is, i can not see job-invocation subcommand.
any help here will be much appreciated.

Do you have the remote execution plugin enabled on your foreman?

Also 2.0.3 is very old.

Yes, remote execution 3.2.2 plugin is installed and enable and i am using it to schedule jobs from WebUI.

We are in planning to upgrade to the n -1 but looking for some docs on how to perform neatly

I was using a hammer development environment, so who knows what was going on on my end :slight_smile:

1 Like

Hi @skv,

It also looks like some resources are missing in the documentation hammer uses to build its commands.

Could you try to run few commands:

  • foreman-rake apipie:cache
  • hammer --reload-cache

hi @ofedoren,

After running foreman-rake apipie:cache it worked.
Thanks for your help.

2 Likes