commit b792ff3feb2cecab7182b3b1be43301de064674d
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Thu Oct 11 14:51:39 2012 +0200
nettestctl: Catch known errors and terminate correctly
If a known error is thrown, LNST drops dead as well as in
case when an unknown exception is raised. Known exceptions
are a part of standard program operation and should not result
in abort with backtrace.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
nettestctl.py | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/nettestctl.py b/nettestctl.py
index c4154d4..b0fb51d 100755
--- a/nettestctl.py
+++ b/nettestctl.py
@@ -16,7 +16,7 @@ import sys
import logging
import os
import re
-from NetTest.NetTestController import NetTestController
+from NetTest.NetTestController import NetTestController, NetTestError
from NetTest.NetTestResultSerializer import NetTestResultSerializer
from Common.Logs import Logs
from Common.LoggingServer import LoggingServer
@@ -77,8 +77,15 @@ def get_recipe_result(args, file_path, remoteexec, cleanup,
Logs.set_logging_root_path(file_path)
loggingServer = LoggingServer(Logs.root_path, Logs.debug)
loggingServer.start()
- res = process_recipe(args, file_path, remoteexec, cleanup, res_serializer,
- packet_capture, config, loggingServer)
+
+ res = None
+ try:
+ res = process_recipe(args, file_path, remoteexec, cleanup,
+ res_serializer, packet_capture,
+ config, loggingServer)
+ except NetTestError as err:
+ logging.error(err)
+
loggingServer.stop()
return ((file_path, res))