firstboot: do not abort configuring other templates if one fails
This commit is contained in:
parent
ed9a728235
commit
73f06661bb
@ -86,10 +86,12 @@ class moduleClass(Module):
|
|||||||
|
|
||||||
errors = []
|
errors = []
|
||||||
|
|
||||||
|
for template in os.listdir('/var/lib/qubes/vm-templates'):
|
||||||
try:
|
try:
|
||||||
self.configure_template()
|
self.configure_template(template)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
errors.append((self.stage, str(e)))
|
errors.append((self.stage, str(e)))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.create_default_netvm()
|
self.create_default_netvm()
|
||||||
self.create_default_fwvm()
|
self.create_default_fwvm()
|
||||||
@ -97,6 +99,7 @@ class moduleClass(Module):
|
|||||||
self.start_qubes_networking()
|
self.start_qubes_networking()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
errors.append((self.stage, str(e)))
|
errors.append((self.stage, str(e)))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.create_default_dvm()
|
self.create_default_dvm()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -138,12 +141,12 @@ class moduleClass(Module):
|
|||||||
def set_default_template(self):
|
def set_default_template(self):
|
||||||
subprocess.call(['/usr/bin/qubes-prefs', '--set', 'default-template', self.default_template])
|
subprocess.call(['/usr/bin/qubes-prefs', '--set', 'default-template', self.default_template])
|
||||||
|
|
||||||
def configure_template(self):
|
def configure_template(self, name):
|
||||||
self.show_stage(_("Configuring default TemplateVM"))
|
self.show_stage(_("Configuring TemplateVM {}".format(name)))
|
||||||
self.run_in_thread(self.do_configure_template)
|
self.run_in_thread(self.do_configure_template, args=(name,))
|
||||||
|
|
||||||
def run_in_thread(self, method):
|
def run_in_thread(self, method, args = None):
|
||||||
thread = threading.Thread(target=method)
|
thread = threading.Thread(target=method, args = (args if args else ()))
|
||||||
thread.start()
|
thread.start()
|
||||||
count = 0
|
count = 0
|
||||||
while thread.is_alive():
|
while thread.is_alive():
|
||||||
@ -254,8 +257,7 @@ class moduleClass(Module):
|
|||||||
def do_start_networking(self):
|
def do_start_networking(self):
|
||||||
self.run_command(['/usr/sbin/service', 'qubes-netvm', 'start'])
|
self.run_command(['/usr/sbin/service', 'qubes-netvm', 'start'])
|
||||||
|
|
||||||
def do_configure_template(self):
|
def do_configure_template(self, template):
|
||||||
for template in os.listdir('/var/lib/qubes/vm-templates'):
|
|
||||||
self.run_command(['qvm-start', '--no-guid', template])
|
self.run_command(['qvm-start', '--no-guid', template])
|
||||||
# Copy timezone setting from Dom0 to template
|
# Copy timezone setting from Dom0 to template
|
||||||
self.run_command(['qvm-run', '--nogui', '--pass-io',
|
self.run_command(['qvm-run', '--nogui', '--pass-io',
|
||||||
|
Loading…
Reference in New Issue
Block a user