Skip to content

Commit 5c559a8

Browse files
committed
Protect against exceptions when getting properties from udev
We've seen online UnicodeDecodeErrors from pyudev, but let's just catch all exceptions here and try to process the device anyway. Fixes: #490
1 parent 28da4a0 commit 5c559a8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

blivet/udev.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ def device_to_dict(device):
7474
# Sice blivet uses Device.properties only (with couple of exceptions)
7575
# this is a functional workaround. (japokorn May 2017)
7676

77-
result = dict(device.properties)
77+
result = dict()
78+
for key in device.properties.keys():
79+
try:
80+
result[key] = device.properties.get(key)
81+
except Exception as e: # pylint: disable=broad-except
82+
log.error("Failed to get %s property of %s: %s", key, device.sys_name, str(e))
7883
result["SYS_NAME"] = device.sys_name
7984
result["SYS_PATH"] = device.sys_path
8085
return result

0 commit comments

Comments
 (0)