mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Add additional examples to grains.list_absent and grains.list_present
Fixes #22534
This commit is contained in:
parent
c75546362f
commit
d44d3e6221
@ -65,21 +65,31 @@ def list_present(name, value):
|
|||||||
'''
|
'''
|
||||||
.. versionadded:: 2014.1.0
|
.. versionadded:: 2014.1.0
|
||||||
|
|
||||||
Ensure the value is present in the list type grain
|
Ensure the value is present in the list type grain.
|
||||||
|
|
||||||
name
|
name
|
||||||
The grain name
|
The grain name.
|
||||||
|
|
||||||
value
|
value
|
||||||
The value is present in the list type grain
|
The value is present in the list type grain.
|
||||||
|
|
||||||
The grain should be `list type <http://docs.python.org/2/tutorial/datastructures.html#data-structures>`_
|
The grain should be `list type <http://docs.python.org/2/tutorial/datastructures.html#data-structures>`_
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
grains.list_present:
|
grains.list_present:
|
||||||
- value: web
|
- value: web
|
||||||
|
|
||||||
|
For multiple grains, the syntax looks like:
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
roles:
|
||||||
|
grains.list_present:
|
||||||
|
- value:
|
||||||
|
- web
|
||||||
|
- dev
|
||||||
'''
|
'''
|
||||||
ret = {'name': name,
|
ret = {'name': name,
|
||||||
'changes': {},
|
'changes': {},
|
||||||
@ -121,21 +131,33 @@ def list_present(name, value):
|
|||||||
|
|
||||||
def list_absent(name, value):
|
def list_absent(name, value):
|
||||||
'''
|
'''
|
||||||
Delete a value from a grain formed as a list
|
Delete a value from a grain formed as a list.
|
||||||
|
|
||||||
|
.. versionadded:: 2014.1.0
|
||||||
|
|
||||||
name
|
name
|
||||||
The grain name
|
The grain name.
|
||||||
|
|
||||||
value
|
value
|
||||||
The value to delete from the grain list
|
The value to delete from the grain list.
|
||||||
|
|
||||||
The grain should be `list type <http://docs.python.org/2/tutorial/datastructures.html#data-structures>`_
|
The grain should be `list type <http://docs.python.org/2/tutorial/datastructures.html#data-structures>`_
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
grains.list_absent:
|
grains.list_absent:
|
||||||
- value: db
|
- value: db
|
||||||
|
|
||||||
|
For multiple grains, the syntax looks like:
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
roles:
|
||||||
|
grains.list_absent:
|
||||||
|
- value:
|
||||||
|
- web
|
||||||
|
- dev
|
||||||
'''
|
'''
|
||||||
ret = {'name': name,
|
ret = {'name': name,
|
||||||
'changes': {},
|
'changes': {},
|
||||||
|
Loading…
Reference in New Issue
Block a user