From 6618104ac314b691402161dc5eab9327232a69b2 Mon Sep 17 00:00:00 2001 From: Yaarit Hatuka Date: Wed, 15 Dec 2021 22:45:57 +0000 Subject: [PATCH] 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 --- src/pybind/mgr/telemetry/module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: -- 2.47.3