Get envs from environment variables to test multi-SUT 65/23065/5
authorzshi <zshi@redhat.com>
Mon, 17 Oct 2016 06:03:14 +0000 (14:03 +0800)
committerzshi <zshi@redhat.com>
Mon, 17 Oct 2016 06:03:14 +0000 (14:03 +0800)
JIRA: DOVETAIL-32

currently envs variable is hard-coded to specific values
which are not suitable for multi-SUT platform, fix it by
reading it from environment variable. this commit is for
apex installer testing purpose.

Change-Id: I2163b96208d42a91f2795de6a55b276b803dc5e8
Signed-off-by: zshi <zshi@redhat.com>
dovetail/container.py

index 54c43ad..6ff3980 100644 (file)
@@ -7,6 +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
@@ -38,6 +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'],