From 2ea283da83ecc180123496bb9200e6ddd362622a Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Thu, 29 Nov 2018 13:28:48 -0800 Subject: [PATCH] pybind/mgr: handle inconsistent api state Signed-off-by: Noah Watkins --- src/pybind/mgr/insights/module.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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'] = {} -- 2.39.5