qubes/features: handle recursive templates in check_with_template

This is the case for DispVMs: DispVM -> AppVM -> TemplateVM
This commit is contained in:
Marek Marczykowski-Górecki 2016-08-17 00:47:32 +02:00
parent 1a215e47ab
commit 460f0849a7
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -126,9 +126,12 @@ class Features(dict):
if feature in self:
return self[feature]
if hasattr(self.vm, 'template') and self.vm.template is not None \
and feature in self.vm.template.features:
return self.vm.template.features[feature]
if hasattr(self.vm, 'template') and self.vm.template is not None:
try:
return self.vm.template.features[feature]
except KeyError:
# handle default just below
pass
if default is self._NO_DEFAULT:
raise KeyError(feature)