summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2023-06-15 23:20:57 +0300
committerGitHub <noreply@github.com>2023-06-15 23:20:57 +0300
commitc67c51e0202d9eafed6a719a49dd6885132c76ec (patch)
tree61f383ccd5f5c184bb927e149264ffbb1ed939bd
parent127bc2cd3bd101556f40d3e5dbfdf8f683027191 (diff)
parente1f2615453b24c81ade8813c8d89e1edcafb1bcf (diff)
downloadvyos-1x-c67c51e0202d9eafed6a719a49dd6885132c76ec.tar.gz
vyos-1x-c67c51e0202d9eafed6a719a49dd6885132c76ec.zip
Merge pull request #2043 from jestabro/fix-load-section
configsession: T5248: load_section should not set path if dict empty
-rw-r--r--python/vyos/configsession.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/python/vyos/configsession.py b/python/vyos/configsession.py
index 88eedb944..decb82437 100644
--- a/python/vyos/configsession.py
+++ b/python/vyos/configsession.py
@@ -166,8 +166,9 @@ class ConfigSession(object):
def load_section(self, path: list, d: dict):
try:
self.delete(path)
- for p in dict_to_paths(d):
- self.set(path + p)
+ if d:
+ for p in dict_to_paths(d):
+ self.set(path + p)
except (ValueError, ConfigSessionError) as e:
raise ConfigSessionError(e)