mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #33457 from rallytime/doc-formatting
Make doc formatting consistent and use correct versionadded
This commit is contained in:
commit
b8154b678e
@ -10,16 +10,19 @@ file on the minions, by default at: /etc/salt/grains
|
||||
Note: This does NOT override any grains set in the minion file.
|
||||
'''
|
||||
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import
|
||||
from salt.defaults import DEFAULT_TARGET_DELIM
|
||||
import re
|
||||
|
||||
# Import Salt libs
|
||||
from salt.defaults import DEFAULT_TARGET_DELIM
|
||||
|
||||
|
||||
def present(name, value, delimiter=DEFAULT_TARGET_DELIM, force=False):
|
||||
'''
|
||||
Ensure that a grain is set
|
||||
|
||||
.. versionchanged:: Boron
|
||||
.. versionchanged:: v2015.8.2
|
||||
|
||||
name
|
||||
The grain name
|
||||
@ -27,14 +30,16 @@ def present(name, value, delimiter=DEFAULT_TARGET_DELIM, force=False):
|
||||
value
|
||||
The value to set on the grain
|
||||
|
||||
:param force: If force is True, the existing grain will be overwritten
|
||||
force
|
||||
If force is True, the existing grain will be overwritten
|
||||
regardless of its existing or provided value type. Defaults to False
|
||||
|
||||
.. versionadded:: Boron
|
||||
.. versionadded:: v2015.8.2
|
||||
|
||||
:param delimiter: A delimiter different from the default can be provided.
|
||||
delimiter
|
||||
A delimiter different from the default can be provided.
|
||||
|
||||
.. versionadded:: Boron
|
||||
.. versionadded:: v2015.8.2
|
||||
|
||||
It is now capable to set a grain to a complex value (ie. lists and dicts)
|
||||
and supports nested grains as well.
|
||||
@ -59,11 +64,11 @@ def present(name, value, delimiter=DEFAULT_TARGET_DELIM, force=False):
|
||||
- name: icinga:Apache SSL
|
||||
- value:
|
||||
- command: check_https
|
||||
- params: -H localhost -p 443 -S
|
||||
- params: -H localhost -p 443 -S
|
||||
|
||||
with,a,custom,delimiter:
|
||||
grains.present:
|
||||
- value: yay
|
||||
- value: yay
|
||||
- delimiter: ,
|
||||
'''
|
||||
name = re.sub(delimiter, DEFAULT_TARGET_DELIM, name)
|
||||
@ -106,9 +111,10 @@ 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.
|
||||
delimiter
|
||||
A delimiter different from the default ``:`` can be provided.
|
||||
|
||||
.. versionadded:: Boron
|
||||
.. versionadded:: v2015.8.2
|
||||
|
||||
The grain should be `list type <http://docs.python.org/2/tutorial/datastructures.html#data-structures>`_
|
||||
|
||||
@ -198,9 +204,10 @@ 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.
|
||||
delimiter
|
||||
A delimiter different from the default ``:`` can be provided.
|
||||
|
||||
.. versionadded:: Boron
|
||||
.. versionadded:: v2015.8.2
|
||||
|
||||
The grain should be `list type <http://docs.python.org/2/tutorial/datastructures.html#data-structures>`_
|
||||
|
||||
@ -273,19 +280,23 @@ def absent(name,
|
||||
name
|
||||
The grain name
|
||||
|
||||
:param destructive: If destructive is True, delete the entire grain. If
|
||||
destructive
|
||||
If destructive is True, delete the entire grain. If
|
||||
destructive is False, set the grain's value to None. Defaults to False.
|
||||
|
||||
:param force: If force is True, the existing grain will be overwritten
|
||||
force
|
||||
If force is True, the existing grain will be overwritten
|
||||
regardless of its existing or provided value type. Defaults to False
|
||||
|
||||
.. versionadded:: Boron
|
||||
.. versionadded:: v2015.8.2
|
||||
|
||||
:param delimiter: A delimiter different from the default can be provided.
|
||||
delimiter
|
||||
A delimiter different from the default can be provided.
|
||||
|
||||
.. versionadded:: Boron
|
||||
.. versionadded:: v2015.8.2
|
||||
|
||||
.. versionchanged:: v2015.8.2
|
||||
|
||||
.. versionchanged:: Boron
|
||||
This state now support nested grains and complex values. It is also more
|
||||
conservative: if a grain has a value that is a list or a dict, it will
|
||||
not be removed unless the `force` parameter is True.
|
||||
@ -367,13 +378,15 @@ def append(name, value, convert=False,
|
||||
value
|
||||
The value to append
|
||||
|
||||
:param convert: If convert is True, convert non-list contents into a list.
|
||||
convert
|
||||
If convert is True, convert non-list contents into a list.
|
||||
If convert is False and the grain contains non-list contents, an error
|
||||
is given. Defaults to False.
|
||||
|
||||
:param delimiter: A delimiter different from the default can be provided.
|
||||
delimiter
|
||||
A delimiter different from the default can be provided.
|
||||
|
||||
.. versionadded:: Boron
|
||||
.. versionadded:: v2015.8.2
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user