summaryrefslogtreecommitdiffstats
path: root/dovetail/conf/dovetail_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'dovetail/conf/dovetail_config.py')
-rw-r--r--dovetail/conf/dovetail_config.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/dovetail/conf/dovetail_config.py b/dovetail/conf/dovetail_config.py
index a5669bda..d812c5c9 100644
--- a/dovetail/conf/dovetail_config.py
+++ b/dovetail/conf/dovetail_config.py
@@ -16,6 +16,12 @@ class DovetailConfig:
dovetail_config = {}
+ CMD_NAME_TRANS = {
+ 'SUT_TYPE': 'INSTALLER_TYPE',
+ 'SUT_IP': 'INSTALLER_IP',
+ 'CON_DEBUG': 'CI_DEBUG',
+ }
+
@classmethod
def load_config_files(cls):
curr_path = os.path.dirname(os.path.abspath(__file__))
@@ -35,11 +41,7 @@ class DovetailConfig:
@classmethod
def cmd_name_trans(cls, cmd_name):
key = cmd_name.upper()
- if key == 'SUT_TYPE':
- key = 'INSTALLER_TYPE'
- if key == 'SUT_IP':
- key = 'INSTALLER_IP'
- return key
+ return cls.CMD_NAME_TRANS.get(key, key)
@classmethod
def update_envs(cls, options):
@@ -48,18 +50,16 @@ class DovetailConfig:
if not options[item] and key in os.environ:
options[item] = os.environ[key]
if options[item]:
- cls.update_config_envs('functest', key)
- cls.update_config_envs('yardstick', key)
+ cls.update_config_envs('functest', key, options[item])
+ cls.update_config_envs('yardstick', key, options[item])
@classmethod
- def update_config_envs(cls, script_type, key):
- if key == 'DEBUG':
- os.environ['CI_DEBUG'] = os.environ[key]
+ def update_config_envs(cls, script_type, key, value):
envs = cls.dovetail_config[script_type]['envs']
old_value = re.findall(r'\s+%s=(.*?)(\s+|$)' % key, envs)
if old_value == []:
- envs += ' -e ' + key + '=' + os.environ[key]
+ envs += ' -e ' + key + '=' + value
else:
- envs = envs.replace(old_value[0][0], os.environ[key])
+ envs = envs.replace(old_value[0][0], value)
cls.dovetail_config[script_type]['envs'] = envs
return envs