commit 4bfdc946b08d9995f886b02b50d250650317034d
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Mon Sep 16 15:03:04 2013 +0200
NetTestController: ensure partial cleanup
This commit adds cleanup to some places that it makes sense and it
wasn't done previously. Mainly when there are errors during
configuration the already configured parts will be cleaned up.
Another case that didn't work properly was when lnst was interrupted
by Ctrl-C during configuration.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/NetTestController.py | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 910b40e..fe92b16 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -418,7 +418,14 @@ class NetTestController:
return {"passed": True}
def config_only_recipe(self):
- self._prepare_network()
+ try:
+ self._prepare_network()
+ except (KeyboardInterrupt, Exception) as exc:
+ msg = "Exception raised during configuration."
+ logging.error(msg)
+ self._cleanup_slaves()
+ raise
+
self._cleanup_slaves(deconfigure=False)
return {"passed": True}
@@ -426,9 +433,10 @@ class NetTestController:
try:
self._prepare_network()
self._prepare_tasks()
- except Exception as exc:
+ except (KeyboardInterrupt, Exception) as exc:
msg = "Exception raised during configuration."
logging.error(msg)
+ self._cleanup_slaves()
raise
if packet_capture:
Show replies by date