diff options
author | John Estabrook <jestabro@vyos.io> | 2023-05-10 16:01:59 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2023-05-10 16:09:41 -0500 |
commit | e8bfd3c7dcf59d9df74de85291bec2ee0f6c2950 (patch) | |
tree | ea7e5baf1f66c6a683dfe1966cef6d44815b91b5 /python/vyos/configtree.py | |
parent | 834a786a308de0ce23e9dbee2a91711305b6e51a (diff) | |
download | vyos-1x-e8bfd3c7dcf59d9df74de85291bec2ee0f6c2950.tar.gz vyos-1x-e8bfd3c7dcf59d9df74de85291bec2ee0f6c2950.zip |
configtree: T5194: add function reference_tree_to_json
Diffstat (limited to 'python/vyos/configtree.py')
-rw-r--r-- | python/vyos/configtree.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/python/vyos/configtree.py b/python/vyos/configtree.py index 9308bdde4..19b9838d4 100644 --- a/python/vyos/configtree.py +++ b/python/vyos/configtree.py @@ -373,6 +373,19 @@ def union(left, right, libpath=LIBPATH): return tree +def reference_tree_to_json(from_dir, to_file, libpath=LIBPATH): + __lib = cdll.LoadLibrary(libpath) + __reference_tree_to_json = __lib.reference_tree_to_json + __reference_tree_to_json.argtypes = [c_char_p, c_char_p] + __get_error = __lib.get_error + __get_error.argtypes = [] + __get_error.restype = c_char_p + + res = __reference_tree_to_json(from_dir.encode(), to_file.encode()) + if res == 1: + msg = __get_error().decode() + raise ConfigTreeError(msg) + class DiffTree: def __init__(self, left, right, path=[], libpath=LIBPATH): if left is None: |