From: Kefu Chai Date: Fri, 29 Jan 2021 04:41:56 +0000 (+0800) Subject: pybind/mgr/status: always map 'mds_version' to a list of dict X-Git-Tag: v17.1.0~3116^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6f68dea55c250d8111c4bb11c55bf610ad4589fe;p=ceph.git pybind/mgr/status: always map 'mds_version' to a list of dict more consistent this way, as json format is supposed to be consumed by a parser not human being. Signed-off-by: Kefu Chai --- diff --git a/src/pybind/mgr/status/module.py b/src/pybind/mgr/status/module.py index f32351f8532..e9f14c5f883 100644 --- a/src/pybind/mgr/status/module.py +++ b/src/pybind/mgr/status/module.py @@ -244,9 +244,10 @@ class Module(MgrModule): if len(mds_versions) == 1: if output_format in ('json', 'json-pretty'): - json_output['mds_version'] = list(mds_versions)[0] + json_output['mds_version'] = [dict(version=k, daemon=v) + for k, v in mds_versions.items()] else: - output += "MDS version: {0}".format(list(mds_versions)[0]) + output += "MDS version: {0}".format([*mds_versions][0]) else: version_table = PrettyTable(["VERSION", "DAEMONS"], border=False)