diff options
author | hongbo tian <hongbo.tianhongbo@huawei.com> | 2017-06-09 07:32:14 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-06-09 07:32:14 +0000 |
commit | d7795dd0b6e10c335dba65f1456d43fee50c121f (patch) | |
tree | 81cd76a85acc265336fdbc35430bb4c3c94c28f4 | |
parent | 2c170360711d8307ffab3fe8070a771650e4fd47 (diff) | |
parent | 5a72ace55ede5bb798435aaa249ebe12e501258e (diff) |
Merge "https+credential support"
-rw-r--r-- | dovetail/container.py | 20 | ||||
-rwxr-xr-x | dovetail/run.py | 11 |
2 files changed, 28 insertions, 3 deletions
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 84bd88f3..c56b343c 100755 --- a/dovetail/run.py +++ b/dovetail/run.py @@ -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) |