Created
December 19, 2018 11:00
-
-
Save jose1711/b314bc69db9c11e88a2156b7fe323efc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat mystate.sls | |
Failed state: | |
test.fail_without_changes | |
Ok state: | |
test.succeed_without_changes | |
Main state: | |
cmd.run: | |
- name: uname | |
- require: | |
- test: Ok state | |
- onfail: | |
- test: Failed state | |
$ .. state.apply mystate | |
myminion: | |
---------- | |
ID: Failed state | |
Function: test.fail_without_changes | |
Result: False | |
Comment: Failure! | |
Started: 11:55:40.201431 | |
Duration: 0.942 ms | |
Changes: | |
---------- | |
ID: Ok state | |
Function: test.succeed_without_changes | |
Result: True | |
Comment: Success! | |
Started: 11:55:40.202651 | |
Duration: 0.881 ms | |
Changes: | |
---------- | |
ID: Main state | |
Function: cmd.run | |
Name: uname | |
Result: True | |
Comment: Command "uname" run | |
Started: 11:55:40.205042 | |
Duration: 29.764 ms | |
Changes: | |
---------- | |
pid: | |
5442 | |
retcode: | |
0 | |
stderr: | |
stdout: | |
Linux | |
Summary for myminion | |
------------ | |
Succeeded: 2 (changed=1) | |
Failed: 1 | |
This is expected, now I will make "Failed state" to not fail. | |
Failed state: | |
- test.fail_without_changes | |
+ test.succeed_without_changes | |
I would expect Main state to not be executed (because onfail condition is not matched), this is not the case though: | |
$ .. state.apply mystate | |
myminion: | |
---------- | |
ID: Failed state | |
Function: test.succeed_without_changes | |
Result: True | |
Comment: Success! | |
Started: 11:58:36.271334 | |
Duration: 0.998 ms | |
Changes: | |
---------- | |
ID: Ok state | |
Function: test.succeed_without_changes | |
Result: True | |
Comment: Success! | |
Started: 11:58:36.272601 | |
Duration: 0.665 ms | |
Changes: | |
---------- | |
ID: Main state | |
Function: cmd.run | |
Name: uname | |
Result: True | |
Comment: Command "uname" run | |
Started: 11:58:36.275573 | |
Duration: 24.221 ms | |
Changes: | |
---------- | |
pid: | |
6484 | |
retcode: | |
0 | |
stderr: | |
stdout: | |
Linux | |
Summary for myminion | |
------------ | |
Succeeded: 3 (changed=1) | |
Failed: 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment