From: Yaarit Hatuka Date: Wed, 15 Dec 2021 22:45:57 +0000 (+0000) Subject: mgr/telemetry: catch also IndexError in gather_device_report() X-Git-Tag: v17.1.0~197^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F44327%2Fhead;p=ceph.git mgr/telemetry: catch also IndexError in gather_device_report() 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 --- diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index 1346a7511e9e..4cb80214e14f 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -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: