summaryrefslogtreecommitdiffstats
path: root/dovetail/container.py
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2016-10-21 08:03:43 +0000
committerxudan <xudan16@huawei.com>2016-11-02 09:05:23 +0000
commit4def3379f3513aa92b6df2f23551082ba7aa6ad4 (patch)
tree5e3279f125bc34b32f7d71cc3a18a78cad37b8ff /dovetail/container.py
parentd8c7fcfd3dd2bf331ca65ca41b593d65e4c0d97a (diff)
dovetail tool: Add cli mechanism for changing envs at run-time
JIRA: DOVETAIL-23 1. Add file cmd_config.yml for defining arguments and options. 2. Using python click module to add and parse cmds in cmd_config.yml 3. Using envs options to update envs in yardstick/functest config file Change-Id: Ie513c0f0a1ed76f29408419a4bcbbcf21334bb3f Signed-off-by: xudan <xudan16@huawei.com>
Diffstat (limited to 'dovetail/container.py')
-rw-r--r--dovetail/container.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/dovetail/container.py b/dovetail/container.py
index 6ff3980d..6d7ac94d 100644
--- a/dovetail/container.py
+++ b/dovetail/container.py
@@ -7,7 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
-import os
+
import utils.dovetail_logger as dt_logger
import utils.dovetail_utils as dt_utils
from conf.dovetail_config import dovetail_config
@@ -39,18 +39,12 @@ class Container:
# sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa "
docker_image = cls.get_docker_image(type)
envs = dovetail_config[type]['envs']
- import re
- for i in ['INSTALLER_TYPE', 'DEPLOY_SCENARIO',
- 'DEPLOY_TYPE', 'CI_DEBUG']:
- envs = re.sub("%s=(\w+)" % i, '%s=%s' % (i, os.getenv(i)), envs)
- envs = re.sub("INSTALLER_IP=\d+\.?\d+\.?\d+\.?\d+",
- 'INSTALLER_IP=' + os.getenv('INSTALLER_IP'), envs)
opts = dovetail_config[type]['opts']
sshkey = ''
result_volume = ' -v %s:%s ' % (dovetail_config['result_dir'],
dovetail_config[type]['result']['dir'])
cmd = 'sudo docker run %s %s %s %s %s /bin/bash' % \
- (opts, envs, sshkey, result_volume, docker_image)
+ (opts, envs, sshkey, result_volume, docker_image)
dt_utils.exec_cmd(cmd, logger)
ret, container_id = \
dt_utils.exec_cmd("sudo docker ps | grep " + docker_image +