aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/functest_utils.py
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-01-15 09:52:49 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-01-15 09:52:49 +0000
commit246b11bd307da2a3a3de9d642a9627aca80e5c4c (patch)
tree248d8f83cd90a73b01bc09feee91e5cc553361f4 /testcases/functest_utils.py
parentdee9be014293503645069ff6796f5231b3f7ae48 (diff)
parent4781a7b06cdba9bcf4489b1cb4e94ffdeec677bd (diff)
Merge "add doctor test case"
Diffstat (limited to 'testcases/functest_utils.py')
-rw-r--r--testcases/functest_utils.py9
1 files changed, 6 insertions, 3 deletions
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]