summaryrefslogtreecommitdiff
path: root/python/vyos/configtree.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-06-06 09:49:51 +0200
committerGitHub <noreply@github.com>2024-06-06 09:49:51 +0200
commitf6752de811ba8a553abd631427e7735b191c1f91 (patch)
tree4aa1bcced8024d5949dd9dc2fab1e94134302131 /python/vyos/configtree.py
parent77cb661d81da44ac89b3fe3a0bca0e255dc430b7 (diff)
parentd34edc5c15f939f87648b0f8588f99474c53b459 (diff)
downloadvyos-1x-f6752de811ba8a553abd631427e7735b191c1f91.tar.gz
vyos-1x-f6752de811ba8a553abd631427e7735b191c1f91.zip
Merge pull request #3587 from jestabro/config-default-system-version
migration: T6006: add system component version to config.boot.default by separating activation from migration
Diffstat (limited to 'python/vyos/configtree.py')
-rw-r--r--python/vyos/configtree.py10
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