Bug #27548

hammer throws "too few arguments (ArgumentError)" when Satellite returns 500

Added by Martin Bacovsky almost 2 years ago. Updated over 1 year ago.

Target version:
Bugzilla link:
Fixed in Releases:
Found in Releases:


Cloned from

Description of problem:
When Satellite returns 500 errors (because Passenger is unhappy), running hammer commands like "hammer ping" results in an ugly error instead of a nice message saying that the Satellite could not be reached.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. make Passenger return an error (like "Web application could not be started" by installing an incompatible GEM version)
2. hammer ping

Actual results:
  1. hammer ping
    Traceback (most recent call last):
    14: from /bin/hammer:23:in `<main>'
    13: from /bin/hammer:23:in `load'
    12: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli- `<top (required)>'
    11: from /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
    10: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli- `run'
    9: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli- `rescue in run'
    8: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli- `handle_exception'
    7: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli- `handle_exception'
    6: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli- `handle_general_exception'
    5: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli- `print_error'
    4: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli- `print_error'
    3: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli- `print_error'
    2: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli- `format'
    1: from /opt/theforeman/tfm/root/usr/share/gems/gems/fast_gettext-1.4.1/lib/fast_gettext/vendor/string.rb:70:in `%'
    /opt/theforeman/tfm/root/usr/share/gems/gems/fast_gettext-1.4.1/lib/fast_gettext/vendor/string.rb:70:in `%': too few arguments (ArgumentError)
Expected results:
A human readable error. Compare this to the error you get when httpd is completely down:
  1. hammer ping
    Could not load the API description from the server:
    Failed to open TCP connection to (Connection refused - connect(2) for "" port 443)
    - is the server down?
    - was 'foreman-rake apipie:cache' run on the server when using apipie cache? (typical production settings)

Additional info:

Associated revisions

Revision 63e9f595 (diff)
Added by Oleh Fedorenko over 1 year ago

Fixes #27548 - Better handling of server exceptions


#1 Updated by Martin Bacovsky almost 2 years ago

  • Triaged changed from No to Yes

#2 Updated by Martin Bacovsky over 1 year ago

  • Team Backlog Hammer added

#3 Updated by Oleh Fedorenko over 1 year ago

  • Difficulty set to medium
  • Assignee set to Oleh Fedorenko
  • Status changed from New to Assigned

#4 Updated by Oleh Fedorenko over 1 year ago

  • Category changed from Other commands to Hammer
  • Project changed from Hammer CLI to Katello
  • Team Backlog deleted (Hammer)

#5 Updated by The Foreman Bot over 1 year ago

  • Status changed from Assigned to Ready For Testing
  • Pull request added

#6 Updated by Oleh Fedorenko over 1 year ago

  • Status changed from Ready For Testing to Closed

#7 Updated by Jonathon Turel over 1 year ago

  • Target version set to Katello 3.15.0

Also available in: Atom PDF