qubes: Fix error in get_vms_based_on()

Not every vm has .template attribute.
This commit is contained in:
Wojtek Porczyk 2016-03-15 01:01:24 +01:00
parent d766b8e110
commit e0210130da

View File

@ -489,7 +489,8 @@ class VMCollection(object):
def get_vms_based_on(self, template): def get_vms_based_on(self, template):
template = self[template] template = self[template]
return set(vm for vm in self if vm.template == template) return set(vm for vm in self
if hasattr(vm, 'template') and vm.template == template)
def get_vms_connected_to(self, netvm): def get_vms_connected_to(self, netvm):