]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: AttributeError: 'NoneType' object has no attribute 'items' in smart...
authorPatrick Seidensal <pseidensal@suse.com>
Wed, 23 Oct 2019 12:31:36 +0000 (14:31 +0200)
committerPatrick Seidensal <pseidensal@suse.com>
Thu, 31 Oct 2019 11:52:17 +0000 (12:52 +0100)
Fixes: https://tracker.ceph.com/issues/42443
Signed-off-by: Patrick Seidensal <pseidensal@suse.com>
src/pybind/mgr/dashboard/controllers/osd.py

index e9eb229aff235202ce8040e6215345b03837055b..32dd56809682d025e2c7e175c6270f29dbedbccb 100644 (file)
@@ -57,6 +57,7 @@ class Osd(RESTController):
         def add_id(osd):
             osd['id'] = osd['osd']
             return osd
+
         resp = {
             osd['osd']: add_id(osd)
             for osd in mgr.get('osd_map')['osds'] if svc_id is None or osd['osd'] == int(svc_id)
@@ -77,11 +78,13 @@ class Osd(RESTController):
             if dev_id not in smart_data:
                 dev_smart_data = mgr.remote('devicehealth', 'do_scrape_daemon', 'osd', svc_id,
                                             dev_id)
-                for _, dev_data in dev_smart_data.items():
-                    if 'error' in dev_data:
-                        logger.warning('[OSD] Error retrieving smartctl data for device ID %s: %s',
-                                       dev_id, dev_smart_data)
-                smart_data.update(dev_smart_data)
+                if dev_smart_data:
+                    for _, dev_data in dev_smart_data.items():
+                        if 'error' in dev_data:
+                            logger.warning(
+                                '[OSD] Error retrieving smartctl data for device ID %s: %s', dev_id,
+                                dev_smart_data)
+                    smart_data.update(dev_smart_data)
         return smart_data
 
     @RESTController.Resource('GET')