grains module and state: documentation fixes

This commit is contained in:
Christophe Drevet-Droguet 2015-10-14 21:46:39 +02:00
parent 1e3f1b0961
commit d40ce3826e
2 changed files with 18 additions and 4 deletions

View File

@ -87,7 +87,7 @@ def get(key, default='', delimiter=DEFAULT_TARGET_DELIM):
pkg:apache
delimiter
:param delimiter:
Specify an alternate delimiter to use when traversing a nested dict
.. versionadded:: 2014.7.0
@ -301,6 +301,7 @@ def append(key, val, convert=False, delimiter=DEFAULT_TARGET_DELIM):
specify the delimiter you use, instead of the default ``:``.
You can now append values to a list in nested dictionnary grains. If the
list doesn't exist at this level, it will be created.
.. versionadded:: 2014.7.6
CLI Example:
@ -342,6 +343,7 @@ def remove(key, val, delimiter=DEFAULT_TARGET_DELIM):
specify the delimiter you use, instead of the default ``:``.
You can now append values to a list in nested dictionnary grains. If the
list doesn't exist at this level, it will be created.
.. versionadded:: Boron
CLI Example:

View File

@ -29,9 +29,11 @@ def present(name, value, delimiter=DEFAULT_TARGET_DELIM, force=False):
:param force: If force is True, the existing grain will be overwritten
regardless of its existing or provided value type. Defaults to False
.. versionadded:: Boron
:param delimiter: A delimiter different from the default can be provided.
.. versionadded:: Boron
It is now capable to set a grain to a complex value (ie. lists and dicts)
@ -58,6 +60,11 @@ def present(name, value, delimiter=DEFAULT_TARGET_DELIM, force=False):
- value:
- command: check_https
- params: -H localhost -p 443 -S
with,a,custom,delimiter:
grains.present:
- value: yay
- delimiter: ,
'''
name = re.sub(delimiter, DEFAULT_TARGET_DELIM, name)
ret = {'name': name,
@ -97,7 +104,8 @@ def list_present(name, value, delimiter=DEFAULT_TARGET_DELIM):
value
The value is present in the list type grain.
:param delimiter: A delimiter different from the default can be provided.
:param delimiter: A delimiter different from the default ``:`` can be provided.
.. versionadded:: Boron
The grain should be `list type <http://docs.python.org/2/tutorial/datastructures.html#data-structures>`_
@ -179,7 +187,8 @@ def list_absent(name, value, delimiter=DEFAULT_TARGET_DELIM):
value
The value to delete from the grain list.
:param delimiter: A delimiter different from the default can be provided.
:param delimiter: A delimiter different from the default ``:`` can be provided.
.. versionadded:: Boron
The grain should be `list type <http://docs.python.org/2/tutorial/datastructures.html#data-structures>`_
@ -249,9 +258,11 @@ def absent(name,
:param force: If force is True, the existing grain will be overwritten
regardless of its existing or provided value type. Defaults to False
.. versionadded:: Boron
:param delimiter: A delimiter different from the default can be provided.
.. versionadded:: Boron
.. versionchanged:: Boron
@ -262,7 +273,7 @@ def absent(name,
.. code-block:: yaml
grain_name:
grains.absent
grains.absent: []
'''
_non_existent = object()
@ -340,6 +351,7 @@ def append(name, value, convert=False,
is given. Defaults to False.
:param delimiter: A delimiter different from the default can be provided.
.. versionadded:: Boron
.. code-block:: yaml