commit 93917e2084c5ccceeb484c697472bb34cc1768a7
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Mon Jun 3 11:43:01 2013 +0200
NetTestController: add command result on crash
If there was an exception raised during command execution, that command
wouldn't have a result assigned. This will be visible in the summary
output as a sequence of commands having passed but the overal recipe
result is FAIL.
This commit fixes that by adding a FAIL result to the command and an
error message to indicate that the command failed because of an
exception.
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, 9 insertions(+), 3 deletions(-)
---
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 3cf3f91..ae2a78a 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -210,9 +210,15 @@ class NetTestController:
seq_passed = True
for command in sequence["commands"]:
logging.info("Executing command: [%s]", str_command(command))
- cmd_res = self._run_command(command)
- if self._res_serializer:
- self._res_serializer.add_cmd_result(command, cmd_res)
+
+ try:
+ cmd_res = self._run_command(command)
+ except Exception as exc:
+ cmd_res = {"passed": False, "err_msg":
"Exception raised."}
+ raise exc
+ finally:
+ if self._res_serializer:
+ self._res_serializer.add_cmd_result(command, cmd_res)
logging.debug("Result: %s", str(cmd_res))
if "res_data" in cmd_res:
res_data = pformat(cmd_res["res_data"])
Show replies by date