From 66e0b6fa6e26786660912edd20df49c91ce13e40 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Mon, 30 Mar 2020 15:15:56 -0500 Subject: migration: T2029: extract the version string instead of stripping --- python/vyos/configtree.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'python') diff --git a/python/vyos/configtree.py b/python/vyos/configtree.py index 84c25ebec..a0b0eb3c1 100644 --- a/python/vyos/configtree.py +++ b/python/vyos/configtree.py @@ -24,10 +24,10 @@ def escape_backslash(string: str) -> str: result = p.sub(r'\\\\', string) return result -def strip_version(s): - """ Split a config string into the config section and the version string """ +def extract_version(s): + """ Extract the version string from the config string """ t = re.split('(^//)', s, maxsplit=1, flags=re.MULTILINE) - return (t[0], ''.join(t[1:])) + return (s, ''.join(t[1:])) def check_path(path): # Necessary type checking @@ -126,7 +126,7 @@ class ConfigTree(object): self.__destroy = self.__lib.destroy self.__destroy.argtypes = [c_void_p] - config_section, version_section = strip_version(config_string) + config_section, version_section = extract_version(config_string) config_section = escape_backslash(config_section) config = self.__from_string(config_section.encode()) if config is None: -- cgit v1.2.3