.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.
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:
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 5Redouane 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 10Redouane 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.
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
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: