Skip to content

Commit

Permalink
mgr/telemetry: check get_metadata return val
Browse files Browse the repository at this point in the history
get_metada() returns 'None' when requesting a missing service, hence
trying to access its content fails. Added a check for osd and mgr
get_metadata() calls.

Fixes: https://tracker.ceph.com/issues/43642
Signed-off-by: Yaarit Hatuka <yaarit@redhat.com>
  • Loading branch information
yaarith committed Feb 4, 2020
1 parent 97fffb1 commit 9e7a0cb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/pybind/mgr/telemetry/module.py
Expand Up @@ -227,7 +227,11 @@ def gather_osd_metadata(self, osd_map):
metadata[key] = defaultdict(int)

for osd in osd_map['osds']:
for k, v in self.get_metadata('osd', str(osd['osd'])).items():
res = self.get_metadata('osd', str(osd['osd'])).items()
if res is None:
self.log.debug('Could not get metadata for osd.%s' % str(osd['osd']))
continue
for k, v in res:
if k not in keys:
continue

Expand All @@ -244,7 +248,11 @@ def gather_mon_metadata(self, mon_map):
metadata[key] = defaultdict(int)

for mon in mon_map['mons']:
for k, v in self.get_metadata('mon', mon['name']).items():
res = self.get_metadata('mon', mon['name']).items()
if res is None:
self.log.debug('Could not get metadata for mon.%s' % (mon['name']))
continue
for k, v in res:
if k not in keys:
continue

Expand Down

0 comments on commit 9e7a0cb

Please sign in to comment.