diff options
author | John Estabrook <jestabro@vyos.io> | 2022-11-29 11:44:29 -0600 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2022-11-29 11:44:29 -0600 |
commit | 40bd9294ddcdbba7e3b829ffe8f5178bba2776ae (patch) | |
tree | 029ec5c8e9ca7767e0a50341e9c9e18eabac4b4c /python/vyos/configdep.py | |
parent | a90f537a5f88664771ec860cb609de8f5b830735 (diff) | |
download | vyos-1x-40bd9294ddcdbba7e3b829ffe8f5178bba2776ae.tar.gz vyos-1x-40bd9294ddcdbba7e3b829ffe8f5178bba2776ae.zip |
conf-mode: T4820: add support for tagnode argument
Diffstat (limited to 'python/vyos/configdep.py')
-rw-r--r-- | python/vyos/configdep.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/python/vyos/configdep.py b/python/vyos/configdep.py index b2bfbbd24..d4b2cc78f 100644 --- a/python/vyos/configdep.py +++ b/python/vyos/configdep.py @@ -69,18 +69,22 @@ def run_config_mode_script(script: str, config: 'Config'): except (VyOSError, ConfigError) as e: raise ConfigError(repr(e)) -def def_closure(target: str, config: 'Config') -> typing.Callable: +def def_closure(target: str, config: 'Config', + tagnode: typing.Optional[str] = None) -> typing.Callable: script = target + '.py' def func_impl(): + if tagnode: + os.environ['VYOS_TAGNODE_VALUE'] = tagnode run_config_mode_script(script, config) return func_impl -def set_dependents(case: str, config: 'Config'): +def set_dependents(case: str, config: 'Config', + tagnode: typing.Optional[str] = None): d = get_dependency_dict(config) k = canon_name_of_path(caller_name()) l = dependent_func.setdefault(k, []) for target in d[k][case]: - func = def_closure(target, config) + func = def_closure(target, config, tagnode) l.append(func) def call_dependents(): |