From 460f0849a7ed00a91a61cdca1428e22d98bcd15d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 17 Aug 2016 00:47:32 +0200 Subject: [PATCH] qubes/features: handle recursive templates in check_with_template This is the case for DispVMs: DispVM -> AppVM -> TemplateVM --- qubes/vm/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/qubes/vm/__init__.py b/qubes/vm/__init__.py index 673eef2f..77fae4ef 100644 --- a/qubes/vm/__init__.py +++ b/qubes/vm/__init__.py @@ -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)