[BUG] Duplicate state_event when requisite change execution order
@frogunder is already working on this.
Since Dec 14, 2021.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
When state_events is enabled, and some requisites in an SLS change the execution order (meaning that execution order is different from file order) we got duplicated events
Setup
A really simple salt deployment with state_events enabled
# grep -v -e '^#' -e '^$' /etc/salt/master
state_events: True
# grep -v -e '^#' -e '^$' /etc/salt/minion
master: 127.0.0.1
Steps to Reproduce the behavior
A really simple SLS:
# cat /srv/salt/my_state.sls
State 1:
test.succeed_without_changes:
- require:
- test: State 2
State 2:
test.succeed_without_changes
When I run salt-call state.sls my_state I get duplicated events salt/job/20211214143402271865/prog/test-salt-3004.novalocal/1
salt/job/20211214143402271865/prog/test-salt-3004.novalocal/0 {
"_stamp": "2021-12-14T14:34:02.641170",
"cmd": "_minion_event",
"data": {
"len": 2,
"ret": {
"__id__": "State 2",
"__run_num__": 0,
"__sls__": "my_state",
"changes": {},
"comment": "Success!",
"duration": 2.042,
"name": "State 2",
"result": true,
"start_time": "14:34:02.627593"
}
},
"id": "test-salt-3004.novalocal",
"jid": "20211214143402271865",
"tag": "salt/job/20211214143402271865/prog/test-salt-3004.novalocal/0"
}
salt/job/20211214143402271865/prog/test-salt-3004.novalocal/1 {
"_stamp": "2021-12-14T14:34:02.656668",
"cmd": "_minion_event",
"data": {
"len": 2,
"ret": {
"__id__": "State 1",
"__run_num__": 1,
"__sls__": "my_state",
"changes": {},
"comment": "Success!",
"duration": 1.863,
"name": "State 1",
"result": true,
"start_time": "14:34:02.646478"
}
},
"id": "test-salt-3004.novalocal",
"jid": "20211214143402271865",
"tag": "salt/job/20211214143402271865/prog/test-salt-3004.novalocal/1"
}
salt/job/20211214143402271865/prog/test-salt-3004.novalocal/1 {
"_stamp": "2021-12-14T14:34:02.672677",
"cmd": "_minion_event",
"data": {
"len": 2,
"ret": {
"__id__": "State 1",
"__run_num__": 1,
"__sls__": "my_state",
"changes": {},
"comment": "Success!",
"duration": 1.863,
"name": "State 1",
"result": true,
"start_time": "14:34:02.646478"
}
},
"id": "test-salt-3004.novalocal",
"jid": "20211214143402271865",
"tag": "salt/job/20211214143402271865/prog/test-salt-3004.novalocal/1"
}
salt/job/20211214143402686602/ret/test-salt-3004.novalocal {
"_stamp": "2021-12-14T14:34:02.688503",
"arg": [
"my_state"
],
"cmd": "_return",
"fun": "state.sls",
"fun_args": [
"my_state"
],
"id": "test-salt-3004.novalocal",
"jid": "20211214143402686602",
"out": "highstate",
"retcode": 0,
"return": {
"test_|-State 1_|-State 1_|-succeed_without_changes": {
"__id__": "State 1",
"__run_num__": 1,
"__sls__": "my_state",
"changes": {},
"comment": "Success!",
"duration": 1.863,
"name": "State 1",
"result": true,
"start_time": "14:34:02.646478"
},
"test_|-State 2_|-State 2_|-succeed_without_changes": {
"__id__": "State 2",
"__run_num__": 0,
"__sls__": "my_state",
"changes": {},
"comment": "Success!",
"duration": 2.042,
"name": "State 2",
"result": true,
"start_time": "14:34:02.627593"
}
},
"tgt": "test-salt-3004.novalocal",
"tgt_type": "glob"
}
Expected behavior
No duplicate events
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Salt Version:
Salt: 3004
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.11.1
libgit2: Not Installed
M2Crypto: 0.35.2
Mako: Not Installed
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.6.8 (default, Nov 16 2020, 16:55:22)
python-gnupg: Not Installed
PyYAML: 3.13
PyZMQ: 17.0.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.1.4
System Versions:
dist: centos 7 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-1160.el7.x86_64
system: Linux
version: CentOS Linux 7 Core
Additional context
Note: the example I show here is not realistic, I know, but my use case was using an "include", like I include a state and I want to tune a bit the execution order using some requisites
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.