summaryrefslogtreecommitdiff
path: root/python/vyos/config.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-05-06 09:58:06 +0200
committerGitHub <noreply@github.com>2020-05-06 09:58:06 +0200
commit57f905a700291c522f3e6d34bf321cbf258b1caf (patch)
tree33528044f989357a1a456fc6eeeb42c22c9421d6 /python/vyos/config.py
parent9afb06a0187c437f01e5de498851b94025cf9dd8 (diff)
parentd6a93991d1a3a5e4575ccd3d586e9f8f48234544 (diff)
downloadvyos-1x-57f905a700291c522f3e6d34bf321cbf258b1caf.tar.gz
vyos-1x-57f905a700291c522f3e6d34bf321cbf258b1caf.zip
Merge pull request #393 from jjakob/disable-address-fix-T2427
T2427: fix interface addressing, bugfix config library, migrate VLAN config to dicts, move VLAN adding to common function
Diffstat (limited to 'python/vyos/config.py')
-rw-r--r--python/vyos/config.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/python/vyos/config.py b/python/vyos/config.py
index 75055a603..0bc6be12a 100644
--- a/python/vyos/config.py
+++ b/python/vyos/config.py
@@ -155,7 +155,7 @@ class Config(object):
``exists("system name-server"`` without ``set_level``.
Args:
- path (str): relative config path
+ path (str|list): relative config path
"""
# Make sure there's always a space between default path (level)
# and path supplied as method argument
@@ -166,7 +166,7 @@ class Config(object):
else:
self._level = []
elif isinstance(path, list):
- self._level = path
+ self._level = path.copy()
else:
raise TypeError("Level path must be either a whitespace-separated string or a list")
@@ -177,7 +177,7 @@ class Config(object):
Returns:
str: current edit level
"""
- return(self._level)
+ return(self._level.copy())
def exists(self, path):
"""
@@ -386,7 +386,7 @@ class Config(object):
values = []
if not values:
- return(default)
+ return(default.copy())
else:
return(values)
@@ -407,7 +407,7 @@ class Config(object):
nodes = []
if not nodes:
- return(default)
+ return(default.copy())
else:
return(nodes)
@@ -448,7 +448,6 @@ class Config(object):
else:
return(value)
-
def return_effective_values(self, path, default=[]):
"""
Retrieve all values of a multi-value node in a running (effective) config
@@ -465,7 +464,7 @@ class Config(object):
values = []
if not values:
- return(default)
+ return(default.copy())
else:
return(values)
@@ -488,6 +487,6 @@ class Config(object):
nodes = []
if not nodes:
- return(default)
+ return(default.copy())
else:
return(nodes)