From: Redouane Kachach Date: Mon, 14 Feb 2022 14:17:31 +0000 (+0100) Subject: mgr/cephadm: Show an error when invalid format X-Git-Tag: v17.2.1~73^2~66 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=1e4b7282e1be2e9f81a7a6691a39f01c797ff956;p=ceph.git mgr/cephadm: Show an error when invalid format Fixes: https://tracker.ceph.com/issues/54198 Signed-off-by: Redouane Kachach (cherry picked from commit d2fa22fd77d4a20f5db0d9315e5efebb016de481) --- diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 8a0181fe70e12..cdf93f7a4bd46 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -43,6 +43,8 @@ class Format(enum.Enum): json = 'json' json_pretty = 'json-pretty' yaml = 'yaml' + xml_pretty = 'xml-pretty' + xml = 'xml' class ServiceType(enum.Enum): @@ -114,6 +116,8 @@ def to_format(what: Any, format: Format, many: bool, cls: Any) -> Any: if many: return yaml.dump_all(to_yaml(copy), default_flow_style=False) return yaml.dump(to_yaml(copy), default_flow_style=False) + elif format == Format.xml or format == Format.xml_pretty: + raise OrchestratorError(f"format '{format.name}' is not implemented.") else: raise OrchestratorError(f'unsupported format type: {format}')