From: Noah Watkins Date: Thu, 29 Nov 2018 21:28:48 +0000 (-0800) Subject: pybind/mgr: handle inconsistent api state X-Git-Tag: v14.1.0~744^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=2ea283da83ecc180123496bb9200e6ddd362622a;p=ceph-ci.git pybind/mgr: handle inconsistent api state Signed-off-by: Noah Watkins --- diff --git a/src/pybind/mgr/insights/module.py b/src/pybind/mgr/insights/module.py index 9f59920f54e..21da24e11fb 100644 --- a/src/pybind/mgr/insights/module.py +++ b/src/pybind/mgr/insights/module.py @@ -209,8 +209,11 @@ class Module(MgrModule): # include stats, including space utilization performance counters. # adapted from dashboard api controller for s in self.get('osd_stats')['osd_stats']: - idx = osd_id_to_idx[s["osd"]] - osd_map["osds"][idx].update({'osd_stats': s}) + try: + idx = osd_id_to_idx[s["osd"]] + osd_map["osds"][idx].update({'osd_stats': s}) + except KeyError as e: + self.log.warning("inconsistent api state: {}".format(str(e))) for osd in osd_map["osds"]: osd['stats'] = {}