Repository navigation
Closed
Labels
bugbroken, incorrect, or confusing behaviorseverity-high2nd top severity, seen by most users, causes major problems
Milestone
Description
Description
When a systemd managed service is running, but not "enabled", salt will change the state to enabled in a test run. However, any watch/watch_in relationships which would trigger in the same state run do not cause a service restart.
Test mode reports that the service will be restarted.
Setup
Have a service which is disabled, but running (here, I've picked salt-master):
Create the following state:
/tmp/servicerestart:
file.touch
salt-master:
service.running:
- enable: True
- watch:
- /tmp/servicerestart
Steps to Reproduce the behavior
Ensure service is disabled, but running:
systemctl disable salt-master
systemctl start salt-master
Apply the state above, in test=false mode:
# salt-call state.apply servicerestart test=false
local:
----------
ID: /tmp/servicerestart
Function: file.touch
Result: True
Comment: Created empty file /tmp/servicerestart
Started: 09:16:22.108305
Duration: 11.975 ms
Changes:
----------
new:
/tmp/servicerestart
----------
ID: salt-master
Function: service.running
Result: True
Comment: Service salt-master has been enabled, and is in the desired state
Started: 09:16:22.137798
Duration: 342.0 ms
Changes:
----------
salt-master:
True
Summary for local
------------
Succeeded: 2 (changed=2)
Failed: 0
------------
Total states run: 2
Total run time: 353.975 ms
Applying the state while the service is "enabled" does, correctly, result in a restart of the service.
Expected behavior
Service will be restarted, and also be enabled.
Screenshots
n/a
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Salt Version:
Salt: 3002
Dependency Versions:
cffi: 1.14.5
cherrypy: unknown
dateutil: 2.8.1
docker-py: 4.4.4
gitdb: 4.0.5
gitpython: 3.1.13
Jinja2: 2.11.3
libgit2: Not Installed
M2Crypto: 0.37.1
Mako: Not Installed
msgpack: 0.6.1
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.20
pycrypto: Not Installed
pycryptodome: 3.10.1
pygit2: Not Installed
Python: 3.6.8 (default, Nov 16 2020, 16:55:22)
python-gnupg: Not Installed
PyYAML: 5.4.1
PyZMQ: 18.0.2
smmap: 3.0.5
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.1
System Versions:
dist: centos 7 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-1160.6.1.el7.x86_64
system: Linux
version: CentOS Linux 7 Core
</details>
**Additional context**
Metadata
Metadata
Assignees
Labels
bugbroken, incorrect, or confusing behaviorseverity-high2nd top severity, seen by most users, causes major problems
Activity
sagetherage commentedon Mar 3, 2021
@OrlandoArcapix Salt v3002 is vulnerable, have you been able to upgrade to 3002.5 and this is still an issue?
Orlando-Richards commentedon Mar 3, 2021
Yeah - i'm on 3002.5 - but it's a virtualenv install - not sure why it's showing 3002, rather than 3002.5 - will check into that.
3002.5 definitely affected!
Orlando-Richards commentedon Mar 3, 2021
As a workaround, having a separate state for
enabledworks fine:Dr-Bone commentedon Mar 21, 2021
Hi
I can confirm this bug with version 3002.5.
First I assumed it has something to do with if the file was present and only modified or not present, but it is only affected by the enabled/disabled state of the systemd service.
To be honest, I would rather not want to apply this work-around to all my states since this is only temporary and can be removed as soon as this bug is fixed. Is there any timeline/eta yet for this bug?
thank you very much!
sagetherage commentedon Mar 22, 2021
I will need to look into getting this fixed and when.
MKLeb commentedon Jun 30, 2023
Hi @OrlandoArcapix, after looking into this for a bit, I seem to have found some relevant documentation detailing that this is expected behavior: https://docs.saltproject.io/en/latest/ref/states/requisites.html#watch.
Specifically...
Closing this as expected behavior.
mitar commentedon Nov 27, 2026
I made a PR to address this: #70974