From 3feb90eef2f5962b5f99521424cd0204fb288ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 29 Nov 2015 04:17:59 +0100 Subject: [PATCH] firstboot: improve salt highstate error reporting Full stdout/stderr is way to much to fit in that error message. Tell the user where it can be found and what to do. --- firstboot/modules/qubes_setup.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/firstboot/modules/qubes_setup.py b/firstboot/modules/qubes_setup.py index 55aa455..5a107e6 100644 --- a/firstboot/modules/qubes_setup.py +++ b/firstboot/modules/qubes_setup.py @@ -233,13 +233,26 @@ class moduleClass(Module): def configure_qubes(self): self.show_stage('Executing qubes configuration') + try: + # get rid of initial entries (from package installation time) + os.rename('/var/log/salt/minion', '/var/log/salt/minion.install') + except OSError: + pass # Refresh minion configuration to make sure all installed formulas are included self.run_command_in_thread(['qubesctl', 'state.sls', 'config', '-l', 'quiet', '--out', 'quiet']) for state in QubesChoice.get_states(): self.run_command_in_thread(['qubesctl', 'top.enable', state, 'saltenv=dom0', '-l', 'quiet', '--out', 'quiet']) - self.run_command_in_thread(['qubesctl', 'state.highstate']) + try: + self.run_command_in_thread(['qubesctl', 'state.highstate']) + except Exception as e: + raise Exception( + "Qubes initial configuration failed. Login to the system and " + "check /var/log/salt/minion for details. " + "You can retry configuration by calling " + "'sudo qubesctl state.highstate' in dom0 (you will get " + "detailed state there).") def configure_default_template(self): self.show_stage('Setting default template')