diff options
author | John Estabrook <jestabro@vyos.io> | 2020-03-30 15:15:56 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2020-03-30 15:23:59 -0500 |
commit | 66e0b6fa6e26786660912edd20df49c91ce13e40 (patch) | |
tree | e7fae5e0a729d3ac6f72130d3b865545029bd94f | |
parent | 626e1a6f53b07a303bf6a17aa41534e41f106543 (diff) | |
download | vyos-1x-66e0b6fa6e26786660912edd20df49c91ce13e40.tar.gz vyos-1x-66e0b6fa6e26786660912edd20df49c91ce13e40.zip |
migration: T2029: extract the version string instead of stripping
-rw-r--r-- | python/vyos/configtree.py | 8 |
1 files changed, 4 insertions, 4 deletions
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: |