diff options
author | John Estabrook <jestabro@vyos.io> | 2024-06-05 19:53:11 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2024-06-05 19:53:11 -0500 |
commit | 4f18517c9b0a912582933ddbc5424759c676c290 (patch) | |
tree | e7133159b200edf6164e0c9933e9d009e493198d /python/vyos/configtree.py | |
parent | c71f6cb19de3400462fde1b745221f9355c393c0 (diff) | |
download | vyos-1x-4f18517c9b0a912582933ddbc5424759c676c290.tar.gz vyos-1x-4f18517c9b0a912582933ddbc5424759c676c290.zip |
migration: T6447: add module compose_config
Diffstat (limited to 'python/vyos/configtree.py')
-rw-r--r-- | python/vyos/configtree.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/python/vyos/configtree.py b/python/vyos/configtree.py index e4b282d72..afd6e030b 100644 --- a/python/vyos/configtree.py +++ b/python/vyos/configtree.py @@ -175,9 +175,11 @@ class ConfigTree(object): def get_version_string(self): return self.__version - def to_string(self, ordered_values=False): + def to_string(self, ordered_values=False, no_version=False): config_string = self.__to_string(self.__config, ordered_values).decode() config_string = unescape_backslash(config_string) + if no_version: + return config_string config_string = "{0}\n{1}".format(config_string, self.__version) return config_string @@ -482,3 +484,9 @@ class DiffTree: add = self.add.to_commands() delete = self.delete.to_commands(op="delete") return delete + "\n" + add + +def deep_copy(config_tree: ConfigTree) -> ConfigTree: + """An inelegant, but reasonably fast, copy; replace with backend copy + """ + D = DiffTree(None, config_tree) + return D.add |