From 80e57e16bea257a6fd6cd721680ce525a364634a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 19 Feb 2019 00:39:41 +0100 Subject: [PATCH] Allow setting default_template to none It may make sense to force explicit template choice on VM creation, especially with more restrictive qrexec policy. --- qubes/app.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qubes/app.py b/qubes/app.py index 10884651..51432b1c 100644 --- a/qubes/app.py +++ b/qubes/app.py @@ -711,7 +711,8 @@ class Qubes(qubes.PropertyHolder): that AppVMs are not connected to the Internet.''') default_template = qubes.VMProperty('default_template', load_stage=3, vmclass=qubes.vm.templatevm.TemplateVM, - doc='Default template for new AppVMs') + doc='Default template for new AppVMs', + allow_none=True) updatevm = qubes.VMProperty('updatevm', load_stage=3, default=None, allow_none=True, doc='''Which VM to use as `yum` proxy for updating AdminVM and @@ -1205,6 +1206,10 @@ class Qubes(qubes.PropertyHolder): kwargs['template'] = self.default_dispvm else: kwargs['template'] = self.default_template + if kwargs['template'] is None: + raise qubes.exc.QubesValueError( + 'Template for the qube not specified, nor default ' + 'template set.') elif 'template' in kwargs and isinstance(kwargs['template'], str): kwargs['template'] = self.domains[kwargs['template']]