mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add test.nop state
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 Unlike test.succeed_without_changes, takes **kwargs to be more flexible. Also removed the test stuff from succeed_without_changes. If a state doesn't make changes, its behavior should be identical whether in test mode or not.
This commit is contained in:
parent
e956d88f5f
commit
a84ce67b8f
1 changed files with 11 additions and 3 deletions
|
@ -43,6 +43,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 +69,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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue