From 4781a7b06cdba9bcf4489b1cb4e94ffdeec677bd Mon Sep 17 00:00:00 2001 From: Ryota MIBU Date: Fri, 15 Jan 2016 00:25:09 +0900 Subject: add doctor test case Change-Id: Ia40face4cb32247542d5841e00caafb2cf927c2e Signed-off-by: Ryota MIBU --- testcases/functest_utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'testcases/functest_utils.py') diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py index e7641b01..a104182b 100644 --- a/testcases/functest_utils.py +++ b/testcases/functest_utils.py @@ -577,7 +577,7 @@ def download_url(url, dest_path): return True -def execute_command(cmd, logger=None): +def execute_command(cmd, logger=None, exit_on_error=True): """ Execute Linux command """ @@ -596,7 +596,9 @@ def execute_command(cmd, logger=None): else: if logger: logger.error("Error when executing command %s" % cmd) - exit(-1) + if exit_on_error: + exit(-1) + return False def get_git_branch(repo_path): @@ -646,7 +648,8 @@ def push_results_to_db(db_url, case_name, logger, pod_name, headers = {'Content-Type': 'application/json'} try: r = requests.post(url, data=json.dumps(params), headers=headers) - logger.debug(r) + if logger: + logger.debug(r) return True except: print "Error:", sys.exc_info()[0] -- cgit 1.2.3-korg