Bug 2006214

Summary: [cephadm] : traceback is dumped when unexpected input is provided for `format` argument
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: Vasishta <vashastr>
Component: CephadmAssignee: Redouane Kachach Elhichou <rkachach>
Status: CLOSED ERRATA QA Contact: Manasa <mgowri>
Severity: low Docs Contact: Karen Norteman <knortema>
Priority: low    
Version: 5.0CC: adking, akraj, kdreyer, rkachach, tserlin, vereddy
Target Milestone: ---Keywords: Rebase
Target Release: 5.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ceph-16.2.8-2.el8cp Doc Type: Bug Fix
Doc Text:
.Users providing `--format` argument with unsupported formats received a traceback Previously, the orchestrator would throw an exception whenever it received a `--format` argument that it did not support, causing users who passed `--format` with unsupported formats to receive a traceback. With this fix, unsupported formats are now properly handled and users providing an unsupported format get a message explaining that the format is unsupported.
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-09 17:36:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2102272    

Description Vasishta 2021-09-21 08:08:03 UTC
Description of problem:
`traceback` is dumped when unexpected input is provided for `format` argument 
(Tried xml)

Version-Release number of selected component (if applicable):
16.2.0-117.el8cp

How reproducible:
Always

Steps to Reproduce:
1. try ceph orch status --detail --format xml

Actual results:
# ceph orch status --detail --format xml 
Error EINVAL: Traceback (most recent call last):
  File "/usr/share/ceph/mgr/mgr_module.py", line 1345, in _handle_command
    return self.handle_command(inbuf, cmd)
  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 167, in handle_command
    return dispatch[cmd['prefix']].call(self, cmd, inbuf)
  File "/usr/share/ceph/mgr/mgr_module.py", line 386, in call
    kwargs = self._collect_args_by_argspec(cmd_dict)
  File "/usr/share/ceph/mgr/mgr_module.py", line 379, in _collect_args_by_argspec
    kwargs[k] = CephArgtype.cast_to(tp, v)
  File "/lib/python3.6/site-packages/ceph_argparse.py", line 243, in cast_to
    return tp(v)
  File "/lib64/python3.6/enum.py", line 293, in __call__
    return cls.__new__(cls, value)
  File "/lib64/python3.6/enum.py", line 535, in __new__
    return cls._missing_(value)
  File "/lib64/python3.6/enum.py", line 548, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 'xml' is not a valid Format

Expected results:
Tracebacks are not expected to be dumped to user for cli call

Additional info:

Comment 1 Sebastian Wagner 2021-09-21 08:24:27 UTC
this might be a real issue: could you verify if other commands that do in fact support xml still properly work? ceph health --format xml

Comment 5 Redouane Kachach Elhichou 2022-03-02 12:03:16 UTC
Issue fixed by the PR: 

https://github.com/ceph/ceph/pull/45023

In the new implementation an error is shown (option not implemented) instead of failing with a stacktrace.

Comment 10 Redouane Kachach Elhichou 2022-06-01 08:24:35 UTC
Thanks for testing the fix. AFAIK, right now there are no plans to support xml format for this option.

Comment 17 errata-xmlrpc 2022-08-09 17:36:05 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 (Moderate: Red Hat Ceph Storage Security, Bug Fix, and Enhancement Update), 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-2022:5997