diff options
author | hongbo tian <hongbo.tianhongbo@huawei.com> | 2016-12-13 01:53:21 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2016-12-13 01:53:21 +0000 |
commit | 098f6a3ccd606adb3f266e9324ef67368fe420d1 (patch) | |
tree | da69b94de6c7a56bffe77b08b30ba648084e6080 | |
parent | a875b9d4ff6b5c8492f38ea87f8e11c02ebe66b9 (diff) | |
parent | 938f256fc4847e878870fa3037eabc7be970f0ea (diff) |
Merge "dovetail tool: add debug option to control the log level showing in screen"
-rw-r--r-- | dovetail/conf/cmd_config.yml | 13 | ||||
-rw-r--r-- | dovetail/conf/dovetail_config.py | 24 | ||||
-rwxr-xr-x | dovetail/run.py | 2 |
3 files changed, 23 insertions, 16 deletions
diff --git a/dovetail/conf/cmd_config.yml b/dovetail/conf/cmd_config.yml index 4e3d0110..35c000ef 100644 --- a/dovetail/conf/cmd_config.yml +++ b/dovetail/conf/cmd_config.yml @@ -31,11 +31,11 @@ cli: - '--DEPLOY_TYPE' - '-T' help: 'DEPLOY_TYPE of the system under test (SUT).' - DEBUG: + CON_DEBUG: flags: - - '--DEBUG' - - '-d' - help: 'DEBUG for showing debug log.' + - '--CON_DEBUG' + - '-c' + help: 'True for showing debug log in functest/yardstick container.' non-envs: testsuite: flags: @@ -52,3 +52,8 @@ cli: - '--tag' - '-o' help: 'Overwrite tags for each docker container (e.g. "functest:stable,yardstick:latest")' + debug: + flags: + - '--debug' + - '-d' + help: 'True for showing debug log in screen.' 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 diff --git a/dovetail/run.py b/dovetail/run.py index 724dc305..d9bc0aaa 100755 --- a/dovetail/run.py +++ b/dovetail/run.py @@ -141,6 +141,8 @@ def clean_results_dir(): def main(*args, **kwargs): """Dovetail compliance test entry!""" clean_results_dir() + if kwargs['debug']: + os.environ['DEBUG'] = kwargs['debug'] create_logs() logger = dt_logger.Logger('run').getLogger() logger.info('================================================') |