-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
bugbroken, incorrect, or confusing behaviorbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone
Description
I expect that when state contains a single require and a single onfail requisite both are inspected and only if both of them pass, the salt state is executed (thus that it's require AND onfail not require OR onfail). This is not the case apparently:
$ 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 an expected behaviour, 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, only require is) but that does not happen.
$ .. 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
Versions Report
Salt Version:
Salt: 2018.3.3
Dependency Versions:
cffi: 1.11.5
cherrypy: unknown
dateutil: 2.7.5
docker-py: Not Installed
gitdb: 2.0.5
gitpython: 2.1.11
ioflo: Not Installed
Jinja2: 2.10
libgit2: 0.27.7
libnacl: Not Installed
M2Crypto: 0.30.1
Mako: 1.0.7
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: 2.19
pycrypto: 3.7.2
pycryptodome: Not Installed
pygit2: 0.27.3
Python: 2.7.15 (default, Jun 27 2018, 13:05:28)
python-gnupg: Not Installed
PyYAML: 3.13
PyZMQ: 17.1.0
RAET: Not Installed
smmap: 2.0.5
timelib: Not Installed
Tornado: 5.1.1
ZMQ: 4.3.0
System Versions:
dist:
locale: UTF-8
machine: x86_64
release: 4.19.8-rt6-1-rt-bfq
system: Linux
version: Not Installed
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugbroken, incorrect, or confusing behaviorbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around3rd level, incorrect or bad functionality, confusing and lacks a work around