rename "delim" argument to "delimiter"

This commit is contained in:
Erik Johnson 2014-08-08 12:29:26 -05:00
parent 82957bb5cc
commit 6943f97e3c

View File

@ -61,7 +61,7 @@ _SANITIZERS = {
}
def get(key, default='', delim=':'):
def get(key, default='', delimiter=':'):
'''
Attempt to retrieve the named value from grains, if the named value is not
available return the passed default. The default return is an empty string.
@ -77,7 +77,7 @@ def get(key, default='', delim=':'):
pkg:apache
delim
delimiter
Specify an alternate delimiter to use when traversing a nested dict
.. versionadded:: 2014.7.0
@ -88,7 +88,10 @@ def get(key, default='', delim=':'):
salt '*' grains.get pkg:apache
'''
return salt.utils.traverse_dict_and_list(__grains__, key, default, delim)
return salt.utils.traverse_dict_and_list(__grains__,
key,
default,
delimiter)
def has_value(key):
@ -439,7 +442,7 @@ def filter_by(lookup_dict, grain='os_family', merge=None, default='default'):
return ret
def _dict_from_path(path, val, delim=':'):
def _dict_from_path(path, val, delimiter=':'):
'''
Given a lookup string in the form of 'foo:bar:baz" return a nested
dictionary of the appropriate depth with the final segment as a value.
@ -448,7 +451,7 @@ def _dict_from_path(path, val, delim=':'):
{"foo": {"bar": {"baz": "somevalue"}}
'''
nested_dict = _infinitedict()
keys = path.rsplit(delim)
keys = path.rsplit(delimiter)
lastplace = reduce(operator.getitem, keys[:-1], nested_dict)
lastplace[keys[-1]] = val