Bug #26046
closedhammer host update --service-level fails with Numeric Value is required
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1671517
Description of problem:
On Satellite 6.4, attempting to change a hosts service level via the hammer cli fails stating that a numeric value is required instead of accepting a string:
[root@galileo ~]# hammer host update --service-level=PREMIUM --id 43
Could not update the host:
Error: Option '--service-level': Numeric value is required..
See: 'hammer host update --help'.
Version-Release number of selected component (if applicable):
Satellite 6.4
How reproducible:
100%
Steps to Reproduce:
1. Login to a Satellite 6.4 system via the command line
2. Attempt to update a hosts service level via `hammer host update --service-level=PREMIUM --id [MYHOSTID]`
3.
Actual results:
[root@galileo ~]# hammer host update --service-level=PREMIUM --id 43
Could not update the host:
Error: Option '--service-level': Numeric value is required..
See: 'hammer host update --help'.
Expected results:
It should update the host service level as it previously did in satellite 6.3
Additional info:
Error from commit:
error in app/controllers/katello/api/v2/host_subscriptions_controller.rb
line #10
wrong:
param :service_level, Integer, :desc => N_("Service level to be used for autoheal.")
correct:
param :service_level, String, :desc => N_("Service level to be used for autoheal.")
Error:
[DEBUG 2019-01-31T16:42:01 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_usage_exception
[ERROR 2019-01-31T16:42:01 Exception] Error: Option '--service-level': Numeric value is required..
See: 'hammer host update --help'.
Could not update the host:
Error: Option '--service-level': Numeric value is required..
See: 'hammer host update --help'.
[ERROR 2019-01-31T16:42:01 Exception]
Clamp::UsageError (Option '--service-level': Numeric value is required..):
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/option/parsing.rb:41:in `rescue in set_options_from_command_line'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/option/parsing.rb:38:in `set_options_from_command_line'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/option/parsing.rb:9:in `parse_options'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:48:in `parse'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.1.1/lib/hammer_cli/abstract.rb:40:in `parse'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:62:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.1.1/lib/hammer_cli/abstract.rb:29: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.1.1/lib/hammer_cli/abstract.rb:29: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.1.1/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.1.1/bin/hammer:143:in `<top (required)>'
/usr/bin/hammer:23:in `load'
/usr/bin/hammer:23:in `<main>'
Workaround:
change /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.42/app/controllers/katello/api/v2/host_subscriptions_controller.rb
from:
param :service_level, Integer, :desc => N_("Service level to be used for autoheal.")
to:
param :service_level, String, :desc => N_("Service level to be used for autoheal.")
FOREMAN_APIPIE_LANGS=en foreman-rake apipie:cache
hammer -dr
Updated by The Foreman Bot about 6 years ago
- Status changed from New to Ready For Testing
- Assignee set to Christine Fouant
- Pull request https://github.com/Katello/katello/pull/7978 added
Updated by Christine Fouant about 6 years ago
- Triaged changed from No to Yes
- Fixed in Releases Katello 3.11.1 added
Updated by Christine Fouant about 6 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset katello|12f9c0abc0ad710836bde6fb7f084aacb3b536b9.