From 3e2b43264496710bc31bbc5c2ecde955b858ea95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Tue, 17 Sep 2019 00:30:47 +0200 Subject: [PATCH] Fixed error with VM being incorrectly listed as its own dependency fixes QubesOS/qubes-issues#4224 --- qubesadmin/tests/utils.py | 2 +- qubesadmin/utils.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/qubesadmin/tests/utils.py b/qubesadmin/tests/utils.py index b2fe962..94e7b88 100644 --- a/qubesadmin/tests/utils.py +++ b/qubesadmin/tests/utils.py @@ -76,7 +76,7 @@ class TestVMUsage(qubesadmin.tests.QubesTestCase): set(result), set([(vm, prop) for vm in self.vms for prop in self.vm_properties if (not vm.startswith('template') - or not prop.startswith('template'))]), + or not prop.startswith('template')) and vm != 'template1']), "Incorrect VM properties listed.") def test_02_empty(self): diff --git a/qubesadmin/utils.py b/qubesadmin/utils.py index c40cf04..d667419 100644 --- a/qubesadmin/utils.py +++ b/qubesadmin/utils.py @@ -136,6 +136,8 @@ def vm_dependencies(app, reference_vm): vm_properties = ['template', 'netvm', 'default_dispvm', 'management_dispvm'] for vm in app.domains: + if vm == reference_vm: + continue for prop in vm_properties: if reference_vm == getattr(vm, prop, None) and \ not vm.property_is_default(prop):