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 <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2021-01-29 12:41:56 +08:00
parent 5ac2901f54
commit 6f68dea55c

View File

@ -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)