summaryrefslogtreecommitdiff
path: root/python/vyos/config.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@sentrium.io>2019-10-25 20:47:25 -0500
committerJohn Estabrook <jestabro@sentrium.io>2019-10-25 21:10:34 -0500
commit69a14678de1c4f9b35414cbb00f33330478e4c58 (patch)
tree102224cdd513c4c6d92d870fc4dfac8694459c4c /python/vyos/config.py
parent1d8e7c841d7eee501e9a822db727fc1eec449b5e (diff)
downloadvyos-1x-69a14678de1c4f9b35414cbb00f33330478e4c58.tar.gz
vyos-1x-69a14678de1c4f9b35414cbb00f33330478e4c58.zip
[vyos.config] T1758: adjust regex for change in Python 3.7
Python 3.7 considers r'\s*' an empty pattern match, instead of the previous behaviour of matching whitespace characters.
Diffstat (limited to 'python/vyos/config.py')
-rw-r--r--python/vyos/config.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/vyos/config.py b/python/vyos/config.py
index 3a340b2da..7f65a9397 100644
--- a/python/vyos/config.py
+++ b/python/vyos/config.py
@@ -127,7 +127,7 @@ class Config(object):
# It may cause problems with exists() when it's used for checking values,
# since values may contain whitespace.
if isinstance(path, str):
- path = re.split(r'\s*', path)
+ path = re.split(r'\s+', path)
elif isinstance(path, list):
pass
else:
@@ -161,7 +161,7 @@ class Config(object):
# and path supplied as method argument
# XXX: for small strings in-place concatenation is not a problem
if isinstance(path, str):
- self._level = re.split(r'\s*', path)
+ self._level = re.split(r'\s+', path)
elif isinstance(path, list):
self._level = path
else:
@@ -192,7 +192,7 @@ class Config(object):
else:
# libvyosconfig exists() works only for _nodes_, not _values_
# libvyattacfg one also worked for values, so we emulate that case here
- path = re.split(r'\s*', path)
+ path = re.split(r'\s+', path)
path_without_value = path[:-1]
path_str = " ".join(path_without_value)
try: