The exists() function (https://github.com/vyos/vyos-1x/blob/0e02a8321f34069832ccd4266b5a82d48b82186a/python/vyos/config.py#L143-L170) uses only return_value, so it works only for nodes with a single value.
We have at least one confirmed issue because of this: https://phabricator.vyos.net/T4354
To make it compatible with nodes with multiple values, we should add also return_values. Basic proof-of-concept:
diff --git a/python/vyos/config.py b/python/vyos/config.py index a5c1ad12..09c8fd03 100644 --- a/python/vyos/config.py +++ b/python/vyos/config.py @@ -164,7 +164,11 @@ class Config(object): path_str = " ".join(path_without_value) try: value = self._session_config.return_value(self._make_path(path_str)) - return (value == path[-1]) + values = self._session_config.return_values(self._make_path(path_str)) + if value and path[-1] == value: + return True + if isinstance(values, list) and path[-1] in values: + return True except vyos.configtree.ConfigTreeError: # node doesn't exist at all return False