mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
states.test.configurable_test_state test mode
Make `configurable_test_state` configurable even in test mode and return the correct result in test mode as per https://docs.saltstack.com/en/latest/ref/states/writing.html#return-data.
This commit is contained in:
parent
8a566ff4b9
commit
f06ff1af1f
1 changed files with 4 additions and 2 deletions
|
@ -189,6 +189,8 @@ def configurable_test_state(name, changes=True, result=True, comment=''):
|
|||
Do we return successfully or not?
|
||||
Accepts True, False, and 'Random'
|
||||
Default is True
|
||||
If test is True and changes is True, this will be None. If test is
|
||||
True and and changes is False, this will be True.
|
||||
comment:
|
||||
String to fill the comment field with.
|
||||
Default is ''
|
||||
|
@ -242,8 +244,8 @@ def configurable_test_state(name, changes=True, result=True, comment=''):
|
|||
'\'Random\'')
|
||||
|
||||
if __opts__['test']:
|
||||
ret['result'] = None
|
||||
ret['comment'] = 'This is a test'
|
||||
ret['result'] = True if changes is False else None
|
||||
ret['comment'] = 'This is a test' if not comment else comment
|
||||
|
||||
return ret
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue