Merge pull request #43973 from terminalmage/fix-grains.has_value

Fix grains.has_value when value is False
This commit is contained in:
Mike Place 2017-10-09 08:59:19 -06:00 committed by GitHub
commit 1d5397ab5b

View file

@ -121,7 +121,7 @@ def get(key, default='', delimiter=DEFAULT_TARGET_DELIM, ordered=True):
def has_value(key):
'''
Determine whether a named value exists in the grains dictionary.
Determine whether a key exists in the grains dictionary.
Given a grains dictionary that contains the following structure::
@ -137,7 +137,10 @@ def has_value(key):
salt '*' grains.has_value pkg:apache
'''
return True if salt.utils.traverse_dict_and_list(__grains__, key, False) else False
return salt.utils.traverse_dict_and_list(
__grains__,
key,
KeyError) is not KeyError
def items(sanitize=False):