Skip to content

Commit

Permalink
Merge pull request #1331 from vojtechtrefny/main_udev-unicode-decode-…
Browse files Browse the repository at this point in the history
…error

Protect against exceptions when getting properties from udev
  • Loading branch information
vojtechtrefny authored Jan 20, 2025
2 parents 28da4a0 + 908955a commit 8f2fcce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion blivet/udev.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ def device_to_dict(device):
# Sice blivet uses Device.properties only (with couple of exceptions)
# this is a functional workaround. (japokorn May 2017)

result = dict(device.properties)
result = dict()
for key in device.properties.keys():
try:
result[key] = device.properties.get(key)
except Exception as e: # pylint: disable=broad-except
log.error("Failed to get %s property of %s: %s", key, device.sys_name, str(e))
result["SYS_NAME"] = device.sys_name
result["SYS_PATH"] = device.sys_path
return result
Expand Down

0 comments on commit 8f2fcce

Please sign in to comment.