Bug 1649231 - hammer --help does not work with --output json, csv and yaml
Summary: hammer --help does not work with --output json, csv and yaml
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Hammer   
(Show other bugs)
Version: 6.5.0
Hardware: Unspecified
OS: Unspecified
medium vote
Target Milestone: 6.5.0
Assignee: satellite6-bugs
QA Contact: vijsingh
Keywords: Regression, Triaged
: 1647323 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2018-11-13 08:21 UTC by Ales Dujicek
Modified: 2019-02-13 22:55 UTC (History)
12 users (show)

Fixed In Version: tfm-rubygem-hammer_cli-
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 25438 None None None 2018-11-13 08:29 UTC
Red Hat Bugzilla 1647323 None CLOSED certain combination of --help and --output=csv causes Error: undefined method `[]' for nil:NilClass 2019-02-14 14:07 UTC

Internal Trackers: 1647323

Description Ales Dujicek 2018-11-13 08:21:07 UTC
Description of problem:

# for output in base table silent csv yaml json; do
  echo ">>> $output"
  hammer -v --output $output hostgroup --help 2>&1 | head -n 2

>>> base
    hammer hostgroup [OPTIONS] SUBCOMMAND [ARG] ...
>>> table
    hammer hostgroup [OPTIONS] SUBCOMMAND [ARG] ...
>>> silent
>>> csv
Error: undefined method `[]' for nil:NilClass
>>> yaml
Error: undefined method `[]' for nil:NilClass
>>> json
Error: undefined method `[]' for nil:NilClass

# hammer --output yaml --help
Traceback (most recent call last):
	12: from /usr/bin/hammer:23:in `<main>'
	11: from /usr/bin/hammer:23:in `load'
	10: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/bin/hammer:147:in `<top (required)>'
	 9: from /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
	 8: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/abstract.rb:28:in `run'
	 7: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/abstract.rb:32:in `rescue in run'
	 6: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/abstract.rb:188:in `handle_exception'
	 5: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/exception_handler.rb:31:in `handle_exception'
	 4: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/exception_handler.rb:78:in `handle_help_wanted'
	 3: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/exception_handler.rb:53:in `print_message'
	 2: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/output/output.rb:19:in `print_message'
	 1: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/output/adapter/yaml.rb:15:in `print_message'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/output/adapter/tree_structure.rb:22:in `prepare_message': undefined method `[]' for nil:NilClass (NoMethodError)

Version-Release number of selected component (if applicable):
Sat 6.5 snap 3

How reproducible:

Comment 1 Nikhil Kathole 2018-11-13 08:27:43 UTC
Looks similar to https://bugzilla.redhat.com/show_bug.cgi?id=1647323

Comment 2 Tomas Strachota 2018-11-13 08:28:59 UTC
Created redmine issue https://projects.theforeman.org/issues/25438 from this bug

Comment 3 Tomas Strachota 2018-11-13 08:39:14 UTC
*** Bug 1647323 has been marked as a duplicate of this bug. ***

Comment 7 pm-sat@redhat.com 2018-12-14 11:10:28 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25438 has been resolved.

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