summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-11-28 14:19:00 -0600
committerGitHub <noreply@github.com>2023-11-28 14:19:00 -0600
commit7ec55fca91f2fd606e16325166b96a18dcb3d2c5 (patch)
treed81255ceabf5fcb32761fb0c3f9985d99c0b4654 /python
parent6d9feb9df38bfcad7c68c2cbbdba7868a715ccef (diff)
parent3fbb1c602bb5a5003f218e437b83401664e02227 (diff)
downloadvyos-1x-7ec55fca91f2fd606e16325166b96a18dcb3d2c5.tar.gz
vyos-1x-7ec55fca91f2fd606e16325166b96a18dcb3d2c5.zip
Merge pull request #2542 from jestabro/single-owner-https-config
http-api: T5782: use single config-mode script for https and http-api
Diffstat (limited to 'python')
-rw-r--r--python/vyos/configdiff.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/python/vyos/configdiff.py b/python/vyos/configdiff.py
index 1ec2dfafe..03b06c6d9 100644
--- a/python/vyos/configdiff.py
+++ b/python/vyos/configdiff.py
@@ -165,6 +165,30 @@ class ConfigDiff(object):
return True
return False
+ def node_changed_presence(self, path=[]) -> bool:
+ if self._diff_tree is None:
+ raise NotImplementedError("diff_tree class not available")
+
+ path = self._make_path(path)
+ before = self._diff_tree.left.exists(path)
+ after = self._diff_tree.right.exists(path)
+ return (before and not after) or (not before and after)
+
+ def node_changed_children(self, path=[]) -> list:
+ if self._diff_tree is None:
+ raise NotImplementedError("diff_tree class not available")
+
+ path = self._make_path(path)
+ add = self._diff_tree.add
+ sub = self._diff_tree.sub
+ children = set()
+ if add.exists(path):
+ children.update(add.list_nodes(path))
+ if sub.exists(path):
+ children.update(sub.list_nodes(path))
+
+ return list(children)
+
def get_child_nodes_diff_str(self, path=[]):
ret = {'add': {}, 'change': {}, 'delete': {}}