From 69a14678de1c4f9b35414cbb00f33330478e4c58 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Fri, 25 Oct 2019 20:47:25 -0500 Subject: [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. --- python/vyos/config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'python/vyos') 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: -- cgit v1.2.3 From 699beffdfc69ab45c6d0e958a4dbf35f744f2a87 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Fri, 6 Dec 2019 15:05:46 -0600 Subject: equuleus: T1862: Use regex pattern \s+ to split strings on whitespace --- python/vyos/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python/vyos') diff --git a/python/vyos/config.py b/python/vyos/config.py index c7bd96e2f..892dcbff7 100644 --- a/python/vyos/config.py +++ b/python/vyos/config.py @@ -161,7 +161,7 @@ class Config(object): # XXX: for small strings in-place concatenation is not a problem if isinstance(path, str): if path: - self._level = re.split(r'\s*', path) + self._level = re.split(r'\s+', path) else: self._level = [] elif isinstance(path, list): -- cgit v1.2.3 From 9dc0d74098f98d2917a85959acd4915fe7a4ffe1 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Tue, 10 Dec 2019 11:05:37 -0600 Subject: vyos.config: T1862: restore regex after merge --- python/vyos/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python/vyos') diff --git a/python/vyos/config.py b/python/vyos/config.py index 1a0da3e54..8bf5a1727 100644 --- a/python/vyos/config.py +++ b/python/vyos/config.py @@ -195,7 +195,7 @@ class Config(object): # libvyosconfig exists() works only for _nodes_, not _values_ # libvyattacfg one also worked for values, so we emulate that case here if isinstance(path, str): - path = re.split(r'\s*', path) + path = re.split(r'\s+', path) path_without_value = path[:-1] path_str = " ".join(path_without_value) try: -- cgit v1.2.3