Merge pull request #27208 from basepi/nop.state.25423

[2015.5] Add test.nop state
This commit is contained in:
Colton Myers 2015-09-18 10:50:17 -06:00
commit f5a322e3f2

View file

@ -8,6 +8,12 @@ Provide test case states that enable easy testing of things to do with
.. code-block:: yaml
always-passes-with-any-kwarg:
test.nop:
- name: foo
- something: else
- foo: bar
always-passes:
test.succeed_without_changes:
- name: foo
@ -43,6 +49,17 @@ from salt.exceptions import SaltInvocationError
log = logging.getLogger(__name__)
def nop(name, **kwargs):
'''
A no-op state that does nothing. Useful in conjunction with the `use`
requisite, or in templates which could otherwise be empty due to jinja
rendering
.. versionadded:: 2015.5.6
'''
return succeed_without_changes(name)
def succeed_without_changes(name):
'''
Returns successful.
@ -58,9 +75,6 @@ def succeed_without_changes(name):
'result': True,
'comment': 'Success!'
}
if __opts__['test']:
ret['result'] = True
ret['comment'] = 'If we weren\'t testing, this would be a success!'
return ret