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>
# 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: