]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/telemetry: catch also IndexError in gather_device_report() 44327/head
authorYaarit Hatuka <yaarit@redhat.com>
Wed, 15 Dec 2021 22:45:57 +0000 (22:45 +0000)
committerYaarit Hatuka <yaarit@redhat.com>
Thu, 16 Dec 2021 02:27:24 +0000 (02:27 +0000)
When generating the device report, we obfuscate host names, which
exist in a device's 'location' key. Some devices do not have a
'location' key, thus we catch a KeyError in these cases; in other cases
the key exists, but its value is an empty list. Skip these too by
catching an IndexError.

Fixes: https://tracker.ceph.com/issues/53603
Signed-off-by: Yaarit Hatuka <yaarit@redhat.com>
src/pybind/mgr/telemetry/module.py

index 1346a7511e9e4395a4242497ecd51ab041f80064..4cb80214e14f89d12626ef82ae4eb5fcb5f87f4b 100644 (file)
@@ -613,7 +613,7 @@ class Module(MgrModule):
             # anonymize host id
             try:
                 host = d['location'][0]['host']
-            except KeyError:
+            except (KeyError, IndexError):
                 continue
             anon_host = self.get_store('host-id/%s' % host)
             if not anon_host: