Merge pull request #29729 from rallytime/fix-14634

Further clarifications on "unless" and "onlyif" requisites.
This commit is contained in:
Mike Place 2015-12-16 07:45:06 -07:00
commit 1f4810be0f

View File

@ -462,13 +462,15 @@ Unless
The ``unless`` requisite specifies that a state should only run when any of
the specified commands return ``False``. The ``unless`` requisite operates
as NOR and is useful in giving more granular control over when a state should
as NAND and is useful in giving more granular control over when a state should
execute.
**NOTE**: Under the hood ``unless`` calls ``cmd.retcode`` with
``python_shell=True``. This means the commands referenced by unless will be
``python_shell=True``. This means the commands referenced by ``unless`` will be
parsed by a shell, so beware of side-effects as this shell will be run with the
same privileges as the salt-minion.
same privileges as the salt-minion. Also be aware that the boolean value is
determined by the shell's concept of ``True`` and ``False``, rather than Python's
concept of ``True`` and ``False``.
.. code-block:: yaml
@ -506,14 +508,16 @@ Onlyif
.. versionadded:: 2014.7.0
``onlyif`` is the opposite of ``unless``. If all of the commands in ``onlyif``
return ``True``, then the state is run. If any of the specified commands
The ``onlyif`` requisite specifies that if each command listed in ``onlyif``
returns ``True``, then the state is run. If any of the specified commands
return ``False``, the state will not run.
**NOTE**: Under the hood ``onlyif`` calls ``cmd.retcode`` with
``python_shell=True``. This means the commands referenced by unless will be
``python_shell=True``. This means the commands referenced by ``onlyif`` will be
parsed by a shell, so beware of side-effects as this shell will be run with the
same privileges as the salt-minion.
same privileges as the salt-minion. Also be aware that the boolean value is
determined by the shell's concept of ``True`` and ``False``, rather than Python's
concept of ``True`` and ``False``.
.. code-block:: yaml