devices: better handle exceptions in device extension
Do not fail app.save() just because listing devices failed, for any reason.
This commit is contained in:
parent
77e84b9ce4
commit
e5de8f4115
@ -241,8 +241,17 @@ class DeviceCollection(object):
|
||||
attached persistently.
|
||||
'''
|
||||
|
||||
devices = self._vm.fire_event('device-list-attached:' + self._bus,
|
||||
persistent=persistent)
|
||||
try:
|
||||
devices = self._vm.fire_event('device-list-attached:' + self._bus,
|
||||
persistent=persistent)
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
self._vm.log.exception(e, 'Failed to list {} devices'.format(
|
||||
self._bus))
|
||||
if persistent is True:
|
||||
# don't break app.save()
|
||||
return self._set
|
||||
else:
|
||||
raise
|
||||
result = set()
|
||||
for dev, options in devices:
|
||||
if dev in self._set and not persistent:
|
||||
|
Loading…
Reference in New Issue
Block a user