Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ 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
Add Comment
Please, Sign In to add comment