summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2016-11-26 08:43:47 +0000
committerDan Xu <xudan16@huawei.com>2016-11-29 09:10:51 +0000
commit1708f79019f5348e2783d5b7994865a86931316b (patch)
tree55ecf8836c0f6e1a3756a967cf132b18c73fd09b
parentb9929410665d9809669b307b04904312d785be5a (diff)
dovetail tool: reorganize statements in class DovetailConfig
1. move some statements in class DovetailConfig into function load_config_files() 2. call load_config_files() in run.py 3. this can only work correctly after moving clean_results_dir() into run.py, see JIRA:DOVETAIL-80 and gerrit https://gerrit.opnfv.org/gerrit/#/c/24929/ JIRA: DOVETAIL-55 Change-Id: I217c1c21dc6ba8849da7c00564f62d3c22cdc391 Signed-off-by: xudan <xudan16@huawei.com>
-rw-r--r--dovetail/conf/dovetail_config.py24
-rwxr-xr-xdovetail/run.py2
2 files changed, 16 insertions, 10 deletions
diff --git a/dovetail/conf/dovetail_config.py b/dovetail/conf/dovetail_config.py
index 8fa1a6d2..c37e8d07 100644
--- a/dovetail/conf/dovetail_config.py
+++ b/dovetail/conf/dovetail_config.py
@@ -21,19 +21,23 @@ class DovetailConfig:
# testarea supported tuple, should adjust accordingly
testarea_supported = ('vimops', 'nfvi', 'ipv6')
- curr_path = os.path.dirname(os.path.abspath(__file__))
+ dovetail_config = {}
- with open(os.path.join(curr_path, 'dovetail_config.yml')) as f:
- dovetail_config = yaml.safe_load(f)
+ @classmethod
+ def load_config_files(cls):
+ curr_path = os.path.dirname(os.path.abspath(__file__))
+ with open(os.path.join(curr_path, 'dovetail_config.yml')) as f:
+ cls.dovetail_config = yaml.safe_load(f)
- for extra_config_file in dovetail_config['include_config']:
- with open(os.path.join(curr_path, extra_config_file)) as f:
- extra_config = yaml.safe_load(f)
- dovetail_config.update(extra_config)
+ for extra_config_file in cls.dovetail_config['include_config']:
+ with open(os.path.join(curr_path, extra_config_file)) as f:
+ extra_config = yaml.safe_load(f)
+ cls.dovetail_config.update(extra_config)
- with open(os.path.join(curr_path, dovetail_config['cli_file_name'])) as f:
- cmd_yml = yaml.safe_load(f)
- dovetail_config['cli'] = cmd_yml[cmd_yml.keys()[0]]
+ path = os.path.join(curr_path, cls.dovetail_config['cli_file_name'])
+ with open(path) as f:
+ cmd_yml = yaml.safe_load(f)
+ cls.dovetail_config['cli'] = cmd_yml[cmd_yml.keys()[0]]
@classmethod
def cmd_name_trans(cls, cmd_name):
diff --git a/dovetail/run.py b/dovetail/run.py
index cc0e7940..865b3996 100755
--- a/dovetail/run.py
+++ b/dovetail/run.py
@@ -155,6 +155,8 @@ def main(*args, **kwargs):
(kwargs['testsuite'], testarea))
+dt_config.load_config_files()
+
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
if dt_config.dovetail_config['cli']['options'] is not None:
for key, value in dt_config.dovetail_config['cli']['options'].items():