From bbfc70bb7815322ab780bba6f8fac8aeeb2a2ad2 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 10381db9c14a7..1e3170282960a 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): @@ -116,6 +118,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