From d2fa22fd77d4a20f5db0d9315e5efebb016de481 Mon Sep 17 00:00:00 2001 From: Redouane Kachach Date: Mon, 14 Feb 2022 15:17:31 +0100 Subject: [PATCH] mgr/cephadm: Show an error when invalid format Fixes: https://tracker.ceph.com/issues/54198 Signed-off-by: Redouane Kachach --- src/pybind/mgr/orchestrator/module.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 2d73361fc6b22..d8ceaf4066c21 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -44,6 +44,8 @@ class Format(enum.Enum): json = 'json' json_pretty = 'json-pretty' yaml = 'yaml' + xml_pretty = 'xml-pretty' + xml = 'xml' class ServiceType(enum.Enum): @@ -115,6 +117,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}') -- 2.39.5