aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils/functest_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'functest/utils/functest_utils.py')
-rw-r--r--functest/utils/functest_utils.py27
1 files changed, 8 insertions, 19 deletions
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py
index 91781bd2..a766ef95 100644
--- a/functest/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -107,7 +107,9 @@ def get_version():
# jenkins-functest-fuel-baremetal-weekly-master-8
# use regex to match branch info
rule = "(dai|week)ly-(.+?)-[0-9]*"
- build_tag = get_build_tag()
+ build_tag = CONST.__getattribute__('BUILD_TAG')
+ if not build_tag:
+ build_tag = 'none'
m = re.search(rule, build_tag)
if m:
return m.group(2)
@@ -128,19 +130,6 @@ def get_pod_name():
return "unknown-pod"
-def get_build_tag():
- """
- Get build tag of jenkins jobs
- """
- try:
- build_tag = os.environ['BUILD_TAG']
- except KeyError:
- logger.info("Impossible to retrieve the build tag")
- build_tag = "none"
-
- return build_tag
-
-
def logger_test_results(project, case_name, status, details):
"""
Format test case results for the logger
@@ -148,7 +137,7 @@ def logger_test_results(project, case_name, status, details):
pod_name = get_pod_name()
scenario = get_scenario()
version = get_version()
- build_tag = get_build_tag()
+ build_tag = CONST.__getattribute__('BUILD_TAG')
db_url = CONST.__getattribute__("results_test_db_url")
logger.info(
@@ -278,14 +267,14 @@ def get_ci_envvars():
def execute_command_raise(cmd, info=False, error_msg="",
- verbose=True, output_file=None):
- ret = execute_command(cmd, info, error_msg, verbose, output_file)
+ verbose=True, output_file=None, env=None):
+ ret = execute_command(cmd, info, error_msg, verbose, output_file, env)
if ret != 0:
raise Exception(error_msg)
def execute_command(cmd, info=False, error_msg="",
- verbose=True, output_file=None):
+ verbose=True, output_file=None, env=None):
if not error_msg:
error_msg = ("The command '%s' failed." % cmd)
msg_exec = ("Executing command: '%s'" % cmd)
@@ -294,7 +283,7 @@ def execute_command(cmd, info=False, error_msg="",
logger.info(msg_exec)
else:
logger.debug(msg_exec)
- p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
+ p = subprocess.Popen(cmd, env=env, shell=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
if output_file:
f = open(output_file, "w")