]> git.ipfire.org Git - nitsi.git/commitdiff
Catch exceptions to avoid crashing the cleanup
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Mon, 21 May 2018 08:12:18 +0000 (10:12 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Mon, 21 May 2018 08:12:18 +0000 (10:12 +0200)
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
src/nitsi/test.py

index 42d7f16ec6640de8b62eede4e85987ea5636b5c5..c46d7df680e8f8819c5c80322b4b38b89433fc7c 100755 (executable)
@@ -114,9 +114,18 @@ class test():
 
     def virtual_environ_stop(self):
         for name in self.virtual_environ.machine_names:
 
     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:
 
         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)
+