]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/status: always map 'mds_version' to a list of dict
authorKefu Chai <kchai@redhat.com>
Fri, 29 Jan 2021 04:41:56 +0000 (12:41 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 29 Jan 2021 11:42:32 +0000 (19:42 +0800)
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>
src/pybind/mgr/status/module.py

index f32351f8532c818b4d756e3100acba631d885127..e9f14c5f883b5d0403aa6da4b5daefebf4b6e65a 100644 (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)