diff options
author | Christian Breunig <christian@breunig.cc> | 2023-12-02 08:43:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-02 08:43:55 +0100 |
commit | 01a85dc583d5939e2396efb5c5550cccab96d4c6 (patch) | |
tree | c6a4ae0a43a9b68ae3456dd9aef9c64d0fdcded4 /python/vyos | |
parent | 883ab5d1c450f8d5fcf30dca5415c2aa15e6c438 (diff) | |
parent | 4fcf4ce92b7c1de479070f5b392520984564ad16 (diff) | |
download | vyos-1x-01a85dc583d5939e2396efb5c5550cccab96d4c6.tar.gz vyos-1x-01a85dc583d5939e2396efb5c5550cccab96d4c6.zip |
Merge pull request #2561 from jestabro/sagitta-http-api
http-api: T5782: simplifications for config mode http-api
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/configdiff.py | 24 | ||||
-rw-r--r-- | python/vyos/defaults.py | 6 |
2 files changed, 24 insertions, 6 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': {}} diff --git a/python/vyos/defaults.py b/python/vyos/defaults.py index b7f39ecb0..2f3580571 100644 --- a/python/vyos/defaults.py +++ b/python/vyos/defaults.py @@ -50,12 +50,6 @@ https_data = { 'listen_addresses' : { '*': ['_'] } } -api_data = { - 'strict' : False, - 'debug' : False, - 'api_keys' : [ {'id' : 'testapp', 'key' : 'qwerty'} ] -} - vyos_cert_data = { 'conf' : '/etc/nginx/snippets/vyos-cert.conf', 'crt' : '/etc/ssl/certs/vyos-selfsigned.crt', |