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: v16.2.8~130^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bbfc70bb7815322ab780bba6f8fac8aeeb2a2ad2;p=ceph.git mgr/cephadm: Show an error when invalid format Fixes: https://tracker.ceph.com/issues/54198 Signed-off-by: Redouane Kachach --- diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 10381db9c14a..1e3170282960 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}')