pybind/mgr/fsstatus: cope with missing 'ceph_version'

The fsstats module assumes ceph_version always exists in daemon
metadata, but it actually might not if run against older daemons
(see previous commit).  As the version here is actually being
presented to the user, I've set it to "unknown" in the missing
case, rather than an empty string.

Signed-off-by: Tim Serong <tserong@suse.com>
This commit is contained in:
Tim Serong 2017-03-24 16:50:05 +01:00
parent 37e7029ac4
commit 7882b86a98

View File

@ -156,7 +156,7 @@ class Module(MgrModule):
) + "/s"
metadata = self.get_metadata('mds', info['name'])
mds_versions[metadata['ceph_version']].append(info['name'])
mds_versions[metadata.get('ceph_version', "unknown")].append(info['name'])
rank_table.add_row([
self.bold(rank.__str__()), c_state, info['name'],
activity,
@ -215,7 +215,7 @@ class Module(MgrModule):
standby_table = PrettyTable(["Standby MDS"])
for standby in fsmap['standbys']:
metadata = self.get_metadata('mds', standby['name'])
mds_versions[metadata['ceph_version']].append(standby['name'])
mds_versions[metadata.get('ceph_version', "unknown")].append(standby['name'])
standby_table.add_row([standby['name']])