diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/configtree.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/python/vyos/configtree.py b/python/vyos/configtree.py index aeeb329c5..21b37e638 100644 --- a/python/vyos/configtree.py +++ b/python/vyos/configtree.py @@ -145,6 +145,10 @@ class ConfigTree(object): self.__exists.argtypes = [c_void_p, c_char_p] self.__exists.restype = c_int + self.__value_exists = self.__lib.value_exists + self.__value_exists.argtypes = [c_void_p, c_char_p, c_char_p] + self.__value_exists.restype = c_int + self.__list_nodes = self.__lib.list_nodes self.__list_nodes.argtypes = [c_void_p, c_char_p] self.__list_nodes.restype = c_char_p @@ -361,6 +365,16 @@ class ConfigTree(object): else: return True + def value_exists(self, path, value): + check_path(path) + path_str = ' '.join(map(str, path)).encode() + + res = self.__value_exists(self.__config, path_str, value) + if res == 0: + return False + else: + return True + def list_nodes(self, path, path_must_exist=True): check_path(path) path_str = ' '.join(map(str, path)).encode() |
