diff options
author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2024-03-31 15:00:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-31 15:00:28 +0300 |
commit | f62827c80466dc7ae74a2f8a1b360f59603bc3fa (patch) | |
tree | 25fd9193764bc84ba6f22ec30f0e9de7359e6af9 /python/vyos/configsession.py | |
parent | 252d03d6e419aae14ae75caed38d1b1001c916a2 (diff) | |
parent | b6c5e66cc44fdec21e6731d98a1065e2adf87b3b (diff) | |
download | vyos-1x-f62827c80466dc7ae74a2f8a1b360f59603bc3fa.tar.gz vyos-1x-f62827c80466dc7ae74a2f8a1b360f59603bc3fa.zip |
Merge pull request #3211 from jestabro/tree-mask
T6185: simplify marshalling of section and config data for config-sync
Diffstat (limited to 'python/vyos/configsession.py')
-rw-r--r-- | python/vyos/configsession.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/python/vyos/configsession.py b/python/vyos/configsession.py index 90842b749..ab7a631bb 100644 --- a/python/vyos/configsession.py +++ b/python/vyos/configsession.py @@ -176,6 +176,25 @@ class ConfigSession(object): except (ValueError, ConfigSessionError) as e: raise ConfigSessionError(e) + def set_section_tree(self, d: dict): + try: + if d: + for p in dict_to_paths(d): + self.set(p) + except (ValueError, ConfigSessionError) as e: + raise ConfigSessionError(e) + + def load_section_tree(self, mask: dict, d: dict): + try: + if mask: + for p in dict_to_paths(mask): + self.delete(p) + if d: + for p in dict_to_paths(d): + self.set(p) + except (ValueError, ConfigSessionError) as e: + raise ConfigSessionError(e) + def comment(self, path, value=None): if not value: value = [""] |