summaryrefslogtreecommitdiffstats
path: root/dovetail/container.py
diff options
context:
space:
mode:
authorMatthewLi <matthew.lijun@huawei.com>2017-06-06 23:46:21 -0400
committerMatthewLi <matthew.lijun@huawei.com>2017-06-08 02:37:21 -0400
commit5a72ace55ede5bb798435aaa249ebe12e501258e (patch)
tree8d7bb5190d212a77610c4328122a1ce684af52ed /dovetail/container.py
parentab4226ed3c39b8d7b759e93e05e27f1247763ec9 (diff)
https+credential support
JIRA: DOVETAIL-440 Change-Id: I69fb96673755545e8e0d78d940870195dbf20a0b Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
Diffstat (limited to 'dovetail/container.py')
-rw-r--r--dovetail/container.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/dovetail/container.py b/dovetail/container.py
index 2d8a9e20..e527a46a 100644
--- a/dovetail/container.py
+++ b/dovetail/container.py
@@ -171,11 +171,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 +