mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix some documentation issues found in jinja filters doc topic
These doc issues were all found in issue #42151. This commit takes care of all of the issues presented in #42151 except for the last task.
This commit is contained in:
parent
afc19048bd
commit
1bbff572ab
2 changed files with 49 additions and 7 deletions
|
@ -335,7 +335,7 @@ Returns:
|
|||
|
||||
.. versionadded:: 2017.7.0
|
||||
|
||||
Wraps a text around quoutes.
|
||||
This text will be wrapped in quotes.
|
||||
|
||||
|
||||
.. jinja_ref:: regex_search
|
||||
|
@ -750,19 +750,43 @@ Returns:
|
|||
|
||||
Check a whitelist and/or blacklist to see if the value matches it.
|
||||
|
||||
Example:
|
||||
This filter can be used with either a whitelist or a blacklist individually,
|
||||
or a whitelist and a blacklist can be passed simultaneously.
|
||||
|
||||
If whitelist is used alone, value membership is checked against the
|
||||
whitelist only. If the value is found, the function returns ``True``.
|
||||
Otherwise, it returns ``False``.
|
||||
|
||||
If blacklist is used alone, value membership is checked against the
|
||||
blacklist only. If the value is found, the function returns ``False``.
|
||||
Otherwise, it returns ``True``.
|
||||
|
||||
If both a whitelist and a blacklist are provided, value membership in the
|
||||
blacklist will be examined first. If the value is not found in the blacklist,
|
||||
then the whitelist is checked. If the value isn't found in the whitelist,
|
||||
the function returns ``False``.
|
||||
|
||||
Whitelist Example:
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{{ 5 | check_whitelist_blacklist(whitelist=[5, 6, 7]) }}
|
||||
{{ 5 | check_whitelist_blacklist(blacklist=[5, 6, 7]) }}
|
||||
{{ 5 | check_whitelist_blacklist(whitelist=[5, 6, 7]) }}
|
||||
|
||||
Returns:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
True
|
||||
True
|
||||
|
||||
Blacklist Example:
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{{ 5 | check_whitelist_blacklist(blacklist=[5, 6, 7]) }}
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
False
|
||||
|
||||
.. jinja_ref:: date_format
|
||||
|
||||
|
@ -1186,7 +1210,7 @@ Example:
|
|||
|
||||
.. code-block:: jinja
|
||||
|
||||
{{ ['192.168.0.1', 'foo', 'bar', 'fe80::'] | ipv4 }}
|
||||
{{ ['192.168.0.1', 'foo', 'bar', 'fe80::'] | ipv6 }}
|
||||
|
||||
Returns:
|
||||
|
||||
|
@ -1224,7 +1248,7 @@ Returns:
|
|||
|
||||
.. versionadded:: 2017.7.0
|
||||
|
||||
Return the size of the network.
|
||||
Return the size of the network. This utility works for both IPv4 and IPv6.
|
||||
|
||||
Example:
|
||||
|
||||
|
|
|
@ -1444,6 +1444,24 @@ def expr_match(line, expr):
|
|||
def check_whitelist_blacklist(value, whitelist=None, blacklist=None):
|
||||
'''
|
||||
Check a whitelist and/or blacklist to see if the value matches it.
|
||||
|
||||
value
|
||||
The item to check the whitelist and/or blacklist against.
|
||||
|
||||
whitelist
|
||||
The list of items that are white-listed. If ``value`` is found
|
||||
in the whitelist, then the function returns ``True``. Otherwise,
|
||||
it returns ``False``.
|
||||
|
||||
blacklist
|
||||
The list of items that are black-listed. If ``value`` is found
|
||||
in the blacklist, then the function returns ``False``. Otherwise,
|
||||
it returns ``True``.
|
||||
|
||||
If both a whitelist and a blacklist are provided, value membership
|
||||
in the blacklist will be examined first. If the value is not found
|
||||
in the blacklist, then the whitelist is checked. If the value isn't
|
||||
found in the whitelist, the function returns ``False``.
|
||||
'''
|
||||
if blacklist is not None:
|
||||
if not hasattr(blacklist, '__iter__'):
|
||||
|
|
Loading…
Add table
Reference in a new issue