mercury, ips, sea, triton, convergence

after gerrit

Change-Id: Iff14047ecc476589aef10c96fae9970133b8bd14
This commit is contained in:
2023-05-09 14:57:34 +02:00
parent 750b5a7794
commit 8039351395
12 changed files with 426 additions and 357 deletions

View File

@ -126,13 +126,15 @@ class Config(dict):
self.modules.append(mod)
def process_file(config_text):
def process_file(filename):
with open(filename, 'rb') as f:
config_text = f.read()
node = NodeCollector()
mods = Collector(Mod)
ns = {'Node': node.add, 'Mod': mods.add, 'Param': Param, 'Command': Param, 'Group': Group}
# pylint: disable=exec-used
exec(config_text, ns)
exec(compile(config_text, filename, 'exec'), ns)
return Config(node, mods)
@ -175,9 +177,7 @@ def load_config(cfgfiles, log):
for cfgfile in cfgfiles.split(','):
filename = to_config_path(cfgfile, log)
log.debug('Parsing config file %s...', filename)
with open(filename, 'rb') as f:
config_text = f.read()
cfg = process_file(config_text)
cfg = process_file(filename)
if config:
config.merge_modules(cfg)
else: