[BUG] [SaltMinion] Formula should not try to restart service if service minion_service_details set to dead and enable false
jynolen opened this issue · comments
Jean-Yves NOLEN commented
Your setup
Formula commit hash / release tag
Versions reports (master & minion)
Salt Version:
Salt: 3002.2
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: 3.4.1
gitdb: 2.0.5
gitpython: 2.1.11
Jinja2: 2.10
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 0.5.6
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: 3.6.1
pygit2: Not Installed
Python: 3.7.3 (default, Jul 25 2020, 13:03:44)
python-gnupg: Not Installed
PyYAML: 3.13
PyZMQ: 17.1.2
smmap: 2.0.5
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.1
System Versions:
dist: debian 10 buster
locale: UTF-8
machine: x86_64
release: 4.19.0-12-amd64
system: Linux
version: Debian GNU/Linux 10 buster
Pillar / config used
salt:
clean_config_d_dir: true
minion_remove_config: true
master_remove_config: true
proxy_remove_config: true
minion_service_details:
state: dead
enabled: False
master_service_details:
state: dead
enabled: False
install_packages: true
py_ver: 'py3'
minion_config_use_TOFS: false
minion:
master: master.salt.jynolen.fr
log_level_logfile: info
master_type: str
use_superseded:
- module.run
fileserver_backend:
- roots
file_roots:
base:
- /srv/salt/states
pillar_roots:
base:
- /srv/salt/pillars
grains:
roles:
- k3s:node
- salt:minion
Bug details
Describe the bug
With the defined pillar the salt-minion is not managed by the formulas (I choose to managed it thanks to supervisord)
But when a change is detection in /etc/salt/minion.d, the formula trigger the cmd.run state that runs service.restart
This should happened only if minion_service_details specify that it's managed by the formulas
Steps to reproduce the bug
Define upper pillar and make a change into the minion pillar (add a grains 4 example)
Expected behaviour
state-minion > cmd.run should not triggers
Attempts to fix the bug
Fix attempt by extending the salt-minion job with
extend:
salt-minion:
cmd.run:
- onlyif:
- {{ "/bin/true" if pillar.salt.minion_service_details.enabled else "/bin/false" }}