Project

General

Profile

Bug #25438

hammer --help does not work with --output json, csv and yaml

Added by Tomáš Strachota 10 months ago. Updated 9 months ago.

Status:
Closed
Priority:
Normal
Category:
Hammer core
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1649231

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

Associated revisions

Revision f30a60f4 (diff)
Added by Oleh Fedorenko 9 months ago

Fixes #25438 - hammer -h does work with --output json, csv, yaml

History

#1 Updated by Tomáš Strachota 10 months ago

  • Assignee set to Oleh Fedorenko
  • Category changed from Other commands to Hammer core
  • Fixed in Releases hammer-cli-0.15.0 added

#2 Updated by Tomáš Strachota 10 months ago

  • Description updated (diff)

#3 Updated by The Foreman Bot 10 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli/pull/295 added

#4 Updated by Oleh Fedorenko 9 months ago

  • Status changed from Ready For Testing to Closed

#5 Updated by Patrick Creech 9 months ago

  • Found in Releases hammer-cli-0.15.0 added
  • Fixed in Releases deleted (hammer-cli-0.15.0)

I'm guessing this was supposed to be 'found in' not 'fixed in', as this commit doesn't exist in 0.15.0

Also available in: Atom PDF