Added more resilience to missing permissions to utils

vm_dependencies function will now no longer throw an exception
when encountering rejection for property_is_default method.
This commit is contained in:
Marta Marczykowska-Górecka 2020-08-05 15:35:18 +02:00
parent a078e1f617
commit 37f0641c26
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B

View File

@ -142,8 +142,13 @@ def vm_dependencies(app, reference_vm):
if vm == reference_vm:
continue
for prop in vm_properties:
if reference_vm == getattr(vm, prop, None) and \
not vm.property_is_default(prop):
if not hasattr(vm, prop):
continue
try:
is_prop_default = vm.property_is_default(prop)
except qubesadmin.exc.QubesPropertyAccessError:
is_prop_default = False
if reference_vm == getattr(vm, prop, None) and not is_prop_default:
result.append((vm, prop))
return result