Fix DeviceInfo objects comparing
Do not crash if the other object is completely different type. Return False ("unequal") instead. This crashed preparing list of devices in qubes-vm-boot-from-device. Fixes QubesOS/qubes-issues#3182
This commit is contained in:
parent
d3ea2845cd
commit
abc0d0063e
@ -91,10 +91,13 @@ class DeviceInfo(object):
|
||||
return hash((str(self.backend_domain), self.ident))
|
||||
|
||||
def __eq__(self, other):
|
||||
try:
|
||||
return (
|
||||
self.backend_domain == other.backend_domain and
|
||||
self.ident == other.ident
|
||||
)
|
||||
except AttributeError:
|
||||
return False
|
||||
|
||||
def __str__(self):
|
||||
return '{!s}:{!s}'.format(self.backend_domain, self.ident)
|
||||
|
Loading…
Reference in New Issue
Block a user