Skip to content

Commit

Permalink
Allow setting default_template to none
Browse files Browse the repository at this point in the history
It may make sense to force explicit template choice on VM creation,
especially with more restrictive qrexec policy.
  • Loading branch information
marmarek committed Feb 27, 2019
1 parent 4f56874 commit 80e57e1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion qubes/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1205,6 +1206,10 @@ def add_new_vm(self, cls, qid=None, **kwargs):
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']]

Expand Down

0 comments on commit 80e57e1

Please sign in to comment.