Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libvyosconfig/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ all: sharedlib
PHONY: depends
depends:
sudo sh -c 'eval $$(opam env --root=/opt/opam --set-root) ;\
opam pin add vyos1x-config https://github.com/vyos/vyos1x-config.git#6e2a6efc5de6c2e395df377fcd273231ad8ed683 -y ; \
opam pin add vyconf https://github.com/vyos/vyconf.git#591dd5ee3dc353655a3c9b17eababaf0864c5514 -y'
opam pin add vyos1x-config https://github.com/vyos/vyos1x-config.git#5f1d834561ce9463ce1900fef7a2614418a412bc -y ; \
opam pin add vyconf https://github.com/vyos/vyconf.git#b5a3d62714bc47f5187a10c8ad0773c9e655e9e4 -y'

sharedlib: depends $(BUILDDIR)/libvyosconfig$(EXTDLL)

Expand Down
6 changes: 3 additions & 3 deletions libvyosconfig/lib/bindings.ml
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ let diff_tree path c_ptr_l c_ptr_r =
| CD.Incommensurable -> error_message := "Incommensurable"; Ctypes.null
| CD.Empty_comparison -> error_message := "Empty comparison"; Ctypes.null

let show_diff cmds path c_ptr_l c_ptr_r =
let diff_compare cmds path c_ptr_l c_ptr_r =
(* alert exn CD.show_diff:
[Config_diff.Incommensurable] caught
[Config_diff.Empty_comparison] caught
Expand All @@ -387,7 +387,7 @@ let show_diff cmds path c_ptr_l c_ptr_r =
let ct_l = Root.get c_ptr_l in
let ct_r = Root.get c_ptr_r in
try
(CD.show_diff[@alert "-exn"]) ~cmds:cmds path ct_l ct_r
(CD.diff_compare[@alert "-exn"]) ~cmds:cmds path ct_l ct_r
with
| CD.Incommensurable -> error_message := "Incommensurable"; "#1@"
| CD.Empty_comparison -> error_message := "Empty comparison"; "#1@"
Expand Down Expand Up @@ -499,7 +499,7 @@ struct
let () = I.internal "return_value" ((ptr void) @-> string @-> returning string) return_value
let () = I.internal "return_values" ((ptr void) @-> string @-> returning string) return_values
let () = I.internal "diff_tree" (string @-> (ptr void) @-> (ptr void) @-> returning (ptr void)) diff_tree
let () = I.internal "show_diff" (bool @-> string @-> (ptr void) @-> (ptr void) @-> returning string) show_diff
let () = I.internal "diff_compare" (bool @-> string @-> (ptr void) @-> (ptr void) @-> returning string) diff_compare
let () = I.internal "tree_union" ((ptr void) @-> (ptr void) @-> returning (ptr void)) tree_union
let () = I.internal "tree_merge" (bool @-> (ptr void) @-> (ptr void) @-> returning (ptr void)) tree_merge
let () = I.internal "reference_tree_to_json" (string @-> string @-> string @-> returning int) reference_tree_to_json
Expand Down
6 changes: 3 additions & 3 deletions python/vyos/config_mgmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from vyos.configtree import ConfigTreeError
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.configtree import show_diff
from vyos.configtree import diff_compare
from vyos.load_config import load
from vyos.load_config import LoadConfigError
from vyos.defaults import directories
Expand Down Expand Up @@ -413,9 +413,9 @@ def compare(
path = [] if commands else self.edit_path
try:
if commands:
out = show_diff(ct1, ct2, path=path, commands=True)
out = diff_compare(ct1, ct2, path=path, commands=True)
else:
out = show_diff(ct1, ct2, path=path)
out = diff_compare(ct1, ct2, path=path)
except ConfigTreeError as e:
return e, 1

Expand Down
10 changes: 5 additions & 5 deletions python/vyos/configtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def get_subtree(self, path, with_node=False):
return subt


def show_diff(left, right, path=[], commands=False, libpath=LIBPATH):
def diff_compare(left, right, path=[], commands=False, libpath=LIBPATH):
if left is None:
left = ConfigTree(config_string='\n')
if right is None:
Expand All @@ -488,14 +488,14 @@ def show_diff(left, right, path=[], commands=False, libpath=LIBPATH):
path_str = ' '.join(map(str, path)).encode()

__lib = cdll.LoadLibrary(libpath)
__show_diff = __lib.show_diff
__show_diff.argtypes = [c_bool, c_char_p, c_void_p, c_void_p]
__show_diff.restype = c_char_p
__diff_compare = __lib.diff_compare
__diff_compare.argtypes = [c_bool, c_char_p, c_void_p, c_void_p]
__diff_compare.restype = c_char_p
__get_error = __lib.get_error
__get_error.argtypes = []
__get_error.restype = c_char_p

res = __show_diff(commands, path_str, left._get_config(), right._get_config())
res = __diff_compare(commands, path_str, left._get_config(), right._get_config())
res = res.decode()
if res == '#1@':
msg = __get_error().decode()
Expand Down
Loading