-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
bugbroken, incorrect, or confusing behaviorbroken, incorrect, or confusing behaviorneeds-more-infowaiting for more infowaiting for more info
Description
Description
I have a module where I execute a state.apply. If there is a service.dead within the state being applied it leads to some strange behaviour (i.e. Log messages get duplicated?). The remainder of the code also doesn't seem to execute normally but im not good enough at debugging to find out exactly what it's doing.
Setup
Module being executed:
testmodule.py
import logging
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s | %(levelname)s | %(message)s')
file_handler = logging.FileHandler('/var/log/testlog.log')
file_handler.setLevel(logging.INFO)
file_handler.setFormatter(formatter)
log.addHandler(file_handler)
def state():
log.info('Running state:')
ret = __salt__['state.apply']('service_dead')
log.info('This is after running state.apply')
return ret
state being called:
service_dead.sls
sshd_baal:
service.dead
- VM (VMWare)
Steps to Reproduce the behavior
Add the custom module and state the the salt environment and execute the module:
salt vmsomething* testmodule.state
Expected behavior
The module gets executed normally and the log should look like this:
testlog.log
2025-03-13 13:09:02,190 | INFO | Running state:
2025-03-13 13:09:04,012 | INFO | This is after running state.apply
What actually happens is the second log entry getting duplicated:
testlog.log
2025-03-13 13:09:02,190 | INFO | Running state:
2025-03-13 13:09:04,012 | INFO | This is after running state.apply
2025-03-13 13:09:04,012 | INFO | This is after running state.apply
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Salt Version:
Salt: 3006.0
Python Version:
Python: 3.6.15 (default, Sep 23 2021, 15:41:43) [GCC]
Dependency Versions:
cffi: 1.13.2
cherrypy: unknown
contextvars: 2.4
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10.1
libgit2: 0.28.4
looseversion: 1.0.2
M2Crypto: 0.38.0
Mako: Not Installed
msgpack: 0.5.6
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 21.3
pycparser: 2.17
pycrypto: 3.9.0
pycryptodome: Not Installed
pygit2: 0.28.2
python-gnupg: Not Installed
PyYAML: 5.4.1
PyZMQ: 17.1.2
relenv: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.2.3
System Versions:
dist: sles 15.4 2022.08
locale: UTF-8
machine: x86_64
release: 5.14.21-150400.24.150-default
system: Linux
version: SLES 15.4 2022.08Metadata
Metadata
Assignees
Labels
bugbroken, incorrect, or confusing behaviorbroken, incorrect, or confusing behaviorneeds-more-infowaiting for more infowaiting for more info