From: Jonatan Schlag Date: Mon, 21 May 2018 08:12:18 +0000 (+0200) Subject: Catch exceptions to avoid crashing the cleanup X-Git-Url: http://git.ipfire.org/?p=nitsi.git;a=commitdiff_plain;h=f9178ad305370c093a94539763ebd3a6e27a6787 Catch exceptions to avoid crashing the cleanup Signed-off-by: Jonatan Schlag --- diff --git a/src/nitsi/test.py b/src/nitsi/test.py index 42d7f16..c46d7df 100755 --- a/src/nitsi/test.py +++ b/src/nitsi/test.py @@ -114,9 +114,18 @@ class test(): def virtual_environ_stop(self): for name in self.virtual_environ.machine_names: - self.virtual_machines[name].shutdown() - self.virtual_machines[name].revert_snapshot() - self.virtual_machines[name].undefine() + # We just catch exception here to avoid + # that we stop the cleanup process if only one command fails + try: + self.virtual_machines[name].shutdown() + self.virtual_machines[name].revert_snapshot() + self.virtual_machines[name].undefine() + except BaseException as e: + self.log.exception(e) for name in self.virtual_environ.network_names: - self.virtual_networks[name].undefine() + try: + self.virtual_networks[name].undefine() + except BaseException as e: + self.log.exception(e) +