Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
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
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.5.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.5.0
Assignee: satellite6-bugs
QA Contact: vijsingh
URL:
Whiteboard:
: 1647323 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-11-13 08:21 UTC by Ales Dujicek
Modified: 2020-07-13 03:40 UTC (History)
12 users (show)

Fixed In Version: tfm-rubygem-hammer_cli-0.15.1.1-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-14 12:38:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 25438 0 Normal Closed hammer --help does not work with --output json, csv and yaml 2020-07-13 03:34:52 UTC
Red Hat Bugzilla 1647323 0 unspecified CLOSED certain combination of --help and --output=csv causes Error: undefined method `[]' for nil:NilClass 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHSA-2019:1222 0 None None None 2019-05-14 12:38:50 UTC

Internal Links: 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
done

>>> base
Usage:
    hammer hostgroup [OPTIONS] SUBCOMMAND [ARG] ...
>>> table
Usage:
    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:
always

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 Satellite Program 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.

Comment 13 errata-xmlrpc 2019-05-14 12:38:41 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:1222


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