mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
If anything is left behind running, terminate it
This commit is contained in:
parent
3604f6a025
commit
e298e7d362
1 changed files with 12 additions and 0 deletions
|
@ -22,6 +22,7 @@ from pytestshellutils.utils.processes import (
|
|||
ProcessResult,
|
||||
_get_cmdline,
|
||||
terminate_process,
|
||||
terminate_process_list,
|
||||
)
|
||||
from pytestskipmarkers.utils import platform
|
||||
from saltfactories.bases import SystemdSaltDaemonImpl
|
||||
|
@ -1012,6 +1013,17 @@ class SaltPkgInstall:
|
|||
if not self.no_uninstall:
|
||||
self.uninstall()
|
||||
|
||||
# Did we left anything running?!
|
||||
procs = []
|
||||
for proc in psutil.process_iter():
|
||||
if "salt" in proc.name():
|
||||
cmdl_strg = " ".join(str(element) for element in _get_cmdline(proc))
|
||||
if "/opt/saltstack" in cmdl_strg:
|
||||
procs.append(proc)
|
||||
|
||||
if procs:
|
||||
terminate_process_list(procs, kill=True, slow_stop=True)
|
||||
|
||||
|
||||
class PkgSystemdSaltDaemonImpl(SystemdSaltDaemonImpl):
|
||||
# pylint: disable=access-member-before-definition
|
||||
|
|
Loading…
Add table
Reference in a new issue