Project

General

Profile

Actions

Bug #23167

closed

hammer arf-report fails with undefined method `resource' for HammerCLI::MainCommand:Class

Added by Lukas Pramuk about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

# hammer arf-report
Error: undefined method `resource' for HammerCLI::MainCommand:Class

debug:

[DEBUG 2018-04-09T03:45:28 Connection] Registered: foreman
[ INFO 2018-04-09T03:45:28 Modules] Extension module hammer_cli_foreman (0.13.pre.develop) loaded.
[ INFO 2018-04-09T03:45:28 Modules] Extension module hammer_cli_foreman_admin (0.0.8) loaded.
[ INFO 2018-04-09T03:45:28 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.3) loaded.
[ INFO 2018-04-09T03:45:28 Modules] Extension module hammer_cli_foreman_discovery (1.0.0) loaded.
[ INFO 2018-04-09T03:45:29 Modules] Extension module hammer_cli_foreman_openscap (0.1.6) loaded.
[ INFO 2018-04-09T03:45:29 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2018-04-09T03:45:29 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2018-04-09T03:45:29 Modules] Extension module hammer_cli_katello (0.11.0) loaded.
[DEBUG 2018-04-09T03:45:29 Init] Using locale 'en'
[DEBUG 2018-04-09T03:45:29 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.pre.develop/locale'
[DEBUG 2018-04-09T03:45:29 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.pre.develop/locale'
[DEBUG 2018-04-09T03:45:29 Init] 'mo' files for locale domain 'hammer-cli-csv' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.3.0/locale'
[DEBUG 2018-04-09T03:45:29 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.4/locale'
[DEBUG 2018-04-09T03:45:29 Init] 'mo' files for locale domain 'hammer-cli-foreman-virt-who-configure' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_virt_who_configure-0.0.3/locale'
[DEBUG 2018-04-09T03:45:29 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.11.0/locale'
[ INFO 2018-04-09T03:45:29 HammerCLI::MainCommand] Called with options: {"option_debug"=>true}
[ WARN 2018-04-09T03:45:29 HammerCLIForemanOpenscap::ArfReport] Resource 'arf_reports' does not exist in the API
[ INFO 2018-04-09T03:45:29 HammerCLIForemanOpenscap::ArfReport] Called with options: {}
[DEBUG 2018-04-09T03:45:29 Exception] Using exception handler HammerCLIForemanOpenscap::ExceptionHandler#handle_help_wanted
[DEBUG 2018-04-09T03:45:29 Exception] Using exception handler HammerCLI::ExceptionHandler#handle_general_exception
[ERROR 2018-04-09T03:45:29 Exception] Error: undefined method `resource' for HammerCLI::MainCommand:Class
Error: undefined method `resource' for HammerCLI::MainCommand:Class
[ERROR 2018-04-09T03:45:29 Exception] 

NoMethodError (undefined method `resource' for HammerCLI::MainCommand:Class):
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.pre.develop/lib/hammer_cli/apipie/resource.rb:10:in `resource'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.pre.develop/lib/hammer_cli/apipie/command.rb:41:in `help'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.pre.develop/lib/hammer_cli/exception_handler.rb:78:in `handle_help_wanted'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.pre.develop/lib/hammer_cli/exception_handler.rb:31:in `handle_exception'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.pre.develop/lib/hammer_cli/messages.rb:26:in `handle_exception'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.pre.develop/lib/hammer_cli/abstract.rb:32:in `rescue in run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.pre.develop/lib/hammer_cli/abstract.rb:28:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.pre.develop/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.pre.develop/bin/hammer:143:in `<top (required)>'
    /usr/bin/hammer:22:in `load'
    /usr/bin/hammer:22:in `<main>'

foreman-1.18.0-0.develop.201804061848git210e295.el7.noarch
katello-3.7.0-1.nightly.el7.noarch

tfm-rubygem-hammer_cli-0.13.pre.develop-1.201803232224gite493035.el7.noarch
tfm-rubygem-hammer_cli_katello-0.11.0-1.201804051800git94089a6.el7.noarch
tfm-rubygem-hammer_cli_foreman-0.13.pre.develop-1.201804041834git768148d.el7.noarch
tfm-rubygem-hammer_cli_foreman_openscap-0.1.6-1.fm1_18.el7.noarch

Actions #1

Updated by Tomáš Strachota about 6 years ago

  • Status changed from New to Need more information

Lukas this seems like you're trying to use the openscap hammer plugin without having the server side plugin installed (I know it deserves a more readable error message). Can you please confirm that you have foreman_openscap installed and that you refreshed the apidoc cache? (foreman-rake apipie:cache).

Actions #2

Updated by Lukas Pramuk about 6 years ago

Tomas, you were right server part was missing however after installing it the CLI error persists:

# foreman-installer --enable-foreman-plugin-openscap --enable-foreman-proxy-plugin-openscap

# rpm -qa *_openscap 
tfm-rubygem-foreman_openscap-0.9.0-1.fm1_18.el7.noarch
rubygem-smart_proxy_openscap-0.6.10-1.el7.noarch
tfm-rubygem-hammer_cli_foreman_openscap-0.1.6-1.fm1_18.el7.noarch

# hammer arf-report
Error: undefined method `resource' for HammerCLI::MainCommand:Class

# foreman-rake apipie:cache
...
2018-04-10 07:45:27 -0400 | Finished

# hammer arf-report
Error: undefined method `resource' for HammerCLI::MainCommand:Class

Actions #3

Updated by Lukas Pramuk about 6 years ago

strange is that delete subcommand is present:

# hammer arf-report create -h
Error: No such sub-command 'create'.

See: 'hammer arf-report --help'.
[root@hp-ml350egen8-01 ~]# hammer arf-report delete -h
Usage:
    hammer arf-report delete [OPTIONS]

Options:
 -h, --help                    Print help

Unfortunately the server does not support such operation.

Actions #4

Updated by Lukas Pramuk about 6 years ago

Close!

The issue was caused by outdated apipie cache. This can happen when enable plugins incrementally and hammer updates its cache after first "real" command.
Obtaining help by -h doesn't belong to commands querying server... Thus working with outdated cache data.

The hammmer cache can be explicitly refreshed by running

# hammer -r

The solution is to install all plugins at once and there will be no need to explicitly refresh hammer cache

Actions #5

Updated by Marek Hulán about 6 years ago

  • Status changed from Need more information to New
  • Priority changed from Normal to Low
Actions #6

Updated by Tomáš Strachota about 6 years ago

  • Status changed from New to Closed

Closing based on the comments above.

Actions

Also available in: Atom PDF