summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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():