Skip to content

Commit

Permalink
mgr/telemetry: catch also IndexError in gather_device_report()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
yaarith committed Dec 16, 2021
1 parent 6a1e2cb commit 6618104
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pybind/mgr/telemetry/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def gather_device_report(self) -> Dict[str, Dict[str, Dict[str, str]]]:
# 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:
Expand Down

0 comments on commit 6618104

Please sign in to comment.