From 715640955f1b6353b2e75c9e419987e2d7151527 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 22 Oct 2019 13:59:28 -0400 Subject: [PATCH] Better handle missing OSD stat keys --- client-common/cluster.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client-common/cluster.py b/client-common/cluster.py index 7ec3feec..11deb7b0 100644 --- a/client-common/cluster.py +++ b/client-common/cluster.py @@ -83,8 +83,16 @@ def getClusterInformation(zk_conn): ceph_osd_healthy_status = list(range(0, ceph_osd_count)) ceph_osd_report_status = list(range(0, ceph_osd_count)) for index, ceph_osd in enumerate(ceph_osd_list): - ceph_osd_up = ceph_osd['stats']['up'] - ceph_osd_in = ceph_osd['stats']['in'] + try: + ceph_osd_up = ceph_osd['stats']['up'] + except KeyError: + ceph_osd_up = 0 + + try: + ceph_osd_in = ceph_osd['stats']['in'] + except KeyError: + ceph_osd_in = 0 + if not ceph_osd_up or not ceph_osd_in: ceph_osd_healthy_status[index] = False else: