summaryrefslogtreecommitdiffstats
path: root/dovetail
diff options
context:
space:
mode:
Diffstat (limited to 'dovetail')
-rw-r--r--dovetail/conf/functest_config.yml2
-rw-r--r--dovetail/conf/yardstick_config.yml2
-rw-r--r--dovetail/container.py20
-rwxr-xr-xdovetail/run.py15
-rw-r--r--dovetail/utils/dovetail_utils.py24
5 files changed, 48 insertions, 15 deletions
diff --git a/dovetail/conf/functest_config.yml b/dovetail/conf/functest_config.yml
index 460506a6..05eaa909 100644
--- a/dovetail/conf/functest_config.yml
+++ b/dovetail/conf/functest_config.yml
@@ -1,7 +1,7 @@
---
functest:
image_name: opnfv/functest
- docker_tag: latest
+ docker_tag: danube.2.0
opts: '-id --privileged=true'
config:
dir: '/home/opnfv/userconfig'
diff --git a/dovetail/conf/yardstick_config.yml b/dovetail/conf/yardstick_config.yml
index 9f56cb11..34d5a0d8 100644
--- a/dovetail/conf/yardstick_config.yml
+++ b/dovetail/conf/yardstick_config.yml
@@ -1,7 +1,7 @@
---
yardstick:
image_name: opnfv/yardstick
- docker_tag: latest
+ docker_tag: danube.2.0
opts: '-id --privileged=true'
config:
dir: '/home/opnfv/userconfig'
diff --git a/dovetail/container.py b/dovetail/container.py
index 39062c84..dd73096d 100644
--- a/dovetail/container.py
+++ b/dovetail/container.py
@@ -172,11 +172,25 @@ class Container(object):
maybe some issue with domain name resolution',
hosts_config_path)
+ cacert_volume = ""
+ cacert = os.getenv('OS_CACERT',)
+ if cacert is not None:
+ if not os.path.isfile(cacert):
+ cls.logger.error("env variable 'OS_CACERT' is set to %s"
+ "but the file does not exist", cacert)
+ return None
+ elif not dovetail_config['config_dir'] in cacert:
+ cls.logger.error("OS_CACERT file has to be put in %s, which"
+ "can be mount into container",
+ dovetail_config['config_dir'])
+ return None
+ cacert_volume = ' -v %s:%s ' % (cacert, cacert)
+
result_volume = ' -v %s:%s ' % (dovetail_config['result_dir'],
dovetail_config[type]['result']['dir'])
- cmd = 'sudo docker run %s %s %s %s %s %s %s %s /bin/bash' % \
- (opts, envs, config, hosts_config, openrc, config_volume,
- result_volume, docker_image)
+ cmd = 'sudo docker run %s %s %s %s %s %s %s %s %s /bin/bash' % \
+ (opts, envs, config, hosts_config, openrc, cacert_volume,
+ config_volume, result_volume, docker_image)
dt_utils.exec_cmd(cmd, cls.logger)
ret, container_id = \
dt_utils.exec_cmd("sudo docker ps | grep " + docker_image +
diff --git a/dovetail/run.py b/dovetail/run.py
index 406b6d37..80cb0980 100755
--- a/dovetail/run.py
+++ b/dovetail/run.py
@@ -95,10 +95,10 @@ def check_tc_result(testcase, logger):
return
if os.path.isfile(result_file):
logger.info("Results have been stored with file %s.", result_file)
- result = Report.get_result(testcase)
- Report.check_result(testcase, result)
else:
logger.error("Fail to store results with file %s.", result_file)
+ result = Report.get_result(testcase)
+ Report.check_result(testcase, result)
def validate_input(input_dict, check_dict, logger):
@@ -204,6 +204,16 @@ def copy_userconfig_files(logger):
dt_utils.exec_cmd(cmd, logger, exit_on_error=False)
+# env_init can source some env variable used in dovetail, such as
+# when https+credential used, OS_CACERT
+def env_init(logger):
+ openrc = os.path.join(dt_cfg.dovetail_config['config_dir'],
+ dt_cfg.dovetail_config['env_file'])
+ if not os.path.isfile(openrc):
+ logger.error("openrc file %s does not exist", openrc)
+ dt_utils.source_env(openrc)
+
+
def main(*args, **kwargs):
"""Dovetail compliance test entry!"""
build_tag = "daily-master-%s" % str(uuid.uuid4())
@@ -219,6 +229,7 @@ def main(*args, **kwargs):
logger.info('Dovetail compliance: %s!', (kwargs['testsuite']))
logger.info('================================================')
logger.info('Build tag: %s', dt_cfg.dovetail_config['build_tag'])
+ env_init(logger)
copy_userconfig_files(logger)
dt_utils.check_docker_version(logger)
validate_input(kwargs, dt_cfg.dovetail_config['validate_input'], logger)
diff --git a/dovetail/utils/dovetail_utils.py b/dovetail/utils/dovetail_utils.py
index f81ddef2..f4e04b0c 100644
--- a/dovetail/utils/dovetail_utils.py
+++ b/dovetail/utils/dovetail_utils.py
@@ -111,21 +111,29 @@ def source_env(env_file):
with open(env_file, 'r') as f:
lines = f.readlines()
for line in lines:
- for match in re.findall(r"export (.*)=(.*)", line):
- match = (match[0].strip('\"'), match[1].strip('\"'))
- match = (match[0].strip('\''), match[1].strip('\''))
- os.environ.update({match[0]: match[1]})
+ if line.lstrip().startswith('export'):
+ for match in re.findall(r"export (.*)=(.*)", line):
+ match = (match[0].strip('\"'), match[1].strip('\"'))
+ match = (match[0].strip('\''), match[1].strip('\''))
+ os.environ.update({match[0]: match[1]})
def get_ext_net_name(env_file, logger=None):
- source_env(env_file)
- cmd_check = "openstack network list"
+ insecure_option = ''
+ insecure = os.getenv('OS_INSECURE',)
+ if insecure == "true":
+ insecure_option = ' --insecure '
+ else:
+ print "Warn: env variable OS_INSECUE is %s, if https+no credential \
+ used, it should be set as true" % insecure
+
+ cmd_check = "openstack %s network list" % insecure_option
ret, msg = exec_cmd(cmd_check, logger)
if ret:
logger.error("The credentials info in %s is invalid." % env_file)
return None
- cmd = "openstack network list --long | grep 'External' | head -1 | \
- awk '{print $4}'"
+ cmd = "openstack %s network list --long | grep 'External' | head -1 | \
+ awk '{print $4}'" % insecure_option
ret, msg = exec_cmd(cmd, logger)
if not ret:
return msg