Skip to content

watch/watch_any not restarting service if service disabled and running #54952

Closed

Description

@mepreston

Description of Issue

systemd service is not restarted if it is already running and disabled. it will enable the service but then will not do a restart per the watch requisite. if the service is running and enabled then it does a restart.

Setup

(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)
see steps to reproduce

Steps to Reproduce Issue

(Include debug logs if possible and relevant.

test case
on salt master:

file fail2ban.sls
fail2ban:
pkg.installed: []
service.running:
- enable: True
- name: fail2ban
- require:
- pkg: fail2ban
- watch:
- file: /etc/fail2ban/jail.local

/etc/fail2ban/jail.local:
file.managed:
- source: salt://fail2ban/files/jail.local
- mode: 644
- require:
- pkg: fail2ban

====
in jail.local you can just make something up that doesn't match what is on the minion now

on minion server setup:
systemctl start fail2ban
systemctl disable fail2ban

run debug on the minion:
salt-call -l debug state.apply fail2ban

and you will see that it enables the service
it updates fail.local
and does NOT restart fail2ban.

if the service is enabled then it will do a restart.

Actual results:
only the service gets enable not restarted after the file change. it should do both an enable and a restart.

Expected results:
From the salt documentation i believe this is a bug as this stack should make sure the service is enabled and restarted if the watch condition is true.

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
Salt: 2019.2.0

Dependency Versions:
cffi: 1.11.5
cherrypy: Not Installed
dateutil: 2.8.0
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.10.1
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.6.1
mysql-python: Not Installed
pycparser: 2.14
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.16 (default, Apr 30 2019, 15:54:43)
python-gnupg: Not Installed
PyYAML: 5.1
PyZMQ: 17.0.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 5.0.2
ZMQ: 4.3.2

System Versions:
dist: fedora 30 Thirty
locale: UTF-8
machine: x86_64
release: 5.2.17-200.fc30.x86_64
system: Linux
version: Fedora 30 Thirty

[mark.preston@vmserver ~]$

Activity

  1. stale commented on Jan 7, 2020

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

    If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

  2. mepreston commented on Jan 7, 2020

    @mepreston
    Author

    then someone better get busy on it because it is still an issue.

  3. stale commented on Jan 7, 2020

    @stale

    Thank you for updating this issue. It is no longer marked as stale.

  4. Ch3LL commented on Jan 13, 2020

    @Ch3LL
    Contributor

    i believe this is a duplicate of #47361.

    If confirmed please close here and we will use that issue to monitor this issue.

  5. added
    Duplicate
    needs-more-info
    and removed on Jan 13, 2020
  6. added this to the Blocked milestone on Jan 13, 2020
  7. mepreston commented on Jan 14, 2020

    @mepreston
    Author

    it seems to be a duplicate.

  8. stale commented on Feb 13, 2020

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

    If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

  9. mitar commented on Nov 27, 2026

    @mitar
    Contributor

    I made a PR to address this: #70974

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Duplicateneeds-more-infostale

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions