commit 0026434b53856cb0d2138248a47a97e6a86dad35
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Aug 15 13:07:43 2012 +0200
NetTestController: Cleanup if prepare fails
Since machine preparation is done during recipe parsing, exceptions
result in a crash of the application without cleaning up the partial
changes.
This commit fixes that by calling cleanup functions after an exception
was raised.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
NetTest/NetTestController.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/NetTest/NetTestController.py b/NetTest/NetTestController.py
index 296150d..839d51c 100644
--- a/NetTest/NetTestController.py
+++ b/NetTest/NetTestController.py
@@ -276,7 +276,14 @@ class NetTestController:
def _prepare(self):
# All the perparations are made within the recipe parsing
# This is achieved by handling parser events (by registering
- self._ntparse.parse_recipe()
+ try:
+ self._ntparse.parse_recipe()
+ except Exception, exc:
+ logging.debug("Exception raised during recipe parsing. "\
+ "Deconfiguring machines.")
+ self._deconfigure_slaves()
+ self._disconnect_slaves()
+ raise exc
def _run_command(self, command):
machine_id = command["machine_id"]
Show replies by date