Bug 1671517 - hammer host update --service-level fails with Numeric Value is required
Summary: hammer host update --service-level fails with Numeric Value is required
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer - Content
Version: 6.4
Hardware: All
OS: Unspecified
medium
medium
Target Milestone: 6.5.0
Assignee: satellite6-bugs
QA Contact: Roman Plevka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-31 19:24 UTC by Russ Zaleski
Modified: 2019-11-05 22:44 UTC (History)
11 users (show)

Fixed In Version: tfm-rubygem-katello-3.10.0.24-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-14 12:40:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 26046 0 Normal Closed hammer host update --service-level fails with Numeric Value is required 2020-01-08 15:30:32 UTC
Red Hat Knowledge Base (Solution) 3879141 0 None None None 2019-01-31 19:57:30 UTC
Red Hat Product Errata RHSA-2019:1222 0 None None None 2019-05-14 12:40:11 UTC

Description Russ Zaleski 2019-01-31 19:24:58 UTC
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:

https://github.com/Katello/katello/commit/29f42a35bb9eddcfc8271bc1e3d1dd569579134d#diff-beaa1cde8d4964406e1f688ae9de5befR10

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

Comment 3 Christine Fouant 2019-02-13 13:58:42 UTC
Created redmine issue https://projects.theforeman.org/issues/26046 from this bug

Comment 4 Bryan Kearney 2019-02-13 15:01:23 UTC
Upstream bug assigned to cfouant

Comment 5 Bryan Kearney 2019-02-13 15:01:24 UTC
Upstream bug assigned to cfouant

Comment 6 Bryan Kearney 2019-02-14 17:01:24 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/26046 has been resolved.

Comment 10 Christine Fouant 2019-03-14 17:41:59 UTC
This remains a candidate for a future sat-6.4.z and will be cloned by the zstream triage team once selected. Thanks!

Comment 14 errata-xmlrpc 2019-05-14 12:40:00 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.