Guest User

Untitled

a guest
Dec 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. $ cat mystate.sls
  2. Failed state:
  3. test.fail_without_changes
  4.  
  5. Ok state:
  6. test.succeed_without_changes
  7.  
  8. Main state:
  9. cmd.run:
  10. - name: uname
  11. - require:
  12. - test: Ok state
  13. - onfail:
  14. - test: Failed state
  15.  
  16. $ .. state.apply mystate
  17. myminion:
  18. ----------
  19. ID: Failed state
  20. Function: test.fail_without_changes
  21. Result: False
  22. Comment: Failure!
  23. Started: 11:55:40.201431
  24. Duration: 0.942 ms
  25. Changes:
  26. ----------
  27. ID: Ok state
  28. Function: test.succeed_without_changes
  29. Result: True
  30. Comment: Success!
  31. Started: 11:55:40.202651
  32. Duration: 0.881 ms
  33. Changes:
  34. ----------
  35. ID: Main state
  36. Function: cmd.run
  37. Name: uname
  38. Result: True
  39. Comment: Command "uname" run
  40. Started: 11:55:40.205042
  41. Duration: 29.764 ms
  42. Changes:
  43. ----------
  44. pid:
  45. 5442
  46. retcode:
  47. 0
  48. stderr:
  49. stdout:
  50. Linux
  51.  
  52. Summary for myminion
  53. ------------
  54. Succeeded: 2 (changed=1)
  55. Failed: 1
  56.  
  57. This is expected, now I will make "Failed state" to not fail.
  58.  
  59. Failed state:
  60. - test.fail_without_changes
  61. + test.succeed_without_changes
  62.  
  63. I would expect Main state to not be executed (because onfail condition is not matched), this is not the case though:
  64.  
  65. $ .. state.apply mystate
  66. myminion:
  67. ----------
  68. ID: Failed state
  69. Function: test.succeed_without_changes
  70. Result: True
  71. Comment: Success!
  72. Started: 11:58:36.271334
  73. Duration: 0.998 ms
  74. Changes:
  75. ----------
  76. ID: Ok state
  77. Function: test.succeed_without_changes
  78. Result: True
  79. Comment: Success!
  80. Started: 11:58:36.272601
  81. Duration: 0.665 ms
  82. Changes:
  83. ----------
  84. ID: Main state
  85. Function: cmd.run
  86. Name: uname
  87. Result: True
  88. Comment: Command "uname" run
  89. Started: 11:58:36.275573
  90. Duration: 24.221 ms
  91. Changes:
  92. ----------
  93. pid:
  94. 6484
  95. retcode:
  96. 0
  97. stderr:
  98. stdout:
  99. Linux
  100.  
  101. Summary for myminion
  102. ------------
  103. Succeeded: 3 (changed=1)
  104. Failed: 0
Add Comment
Please, Sign In to add comment