fixed re-testing of child-processes
This commit is contained in:
parent
5b7f847fe6
commit
7f84e141c8
@ -74,7 +74,7 @@ def restart_services():
|
|||||||
|
|
||||||
# perform a second check to remove potential false positives
|
# perform a second check to remove potential false positives
|
||||||
service_procs = set()
|
service_procs = set()
|
||||||
retest_procs = set()
|
retest_procs = {}
|
||||||
for proc in check_procs:
|
for proc in check_procs:
|
||||||
files = _get_deleted_open_files(proc)
|
files = _get_deleted_open_files(proc)
|
||||||
if not files:
|
if not files:
|
||||||
@ -90,11 +90,13 @@ def restart_services():
|
|||||||
log.debug('will attempt to restart parent of {}'.format(proc))
|
log.debug('will attempt to restart parent of {}'.format(proc))
|
||||||
if len(parents) < 2:
|
if len(parents) < 2:
|
||||||
log.debug('{} is its own top parent'.format(proc))
|
log.debug('{} is its own top parent'.format(proc))
|
||||||
|
parent = proc
|
||||||
service_procs.add(proc)
|
service_procs.add(proc)
|
||||||
else:
|
else:
|
||||||
log.debug('{} has top parent {}'.format(proc, parents[-2]))
|
log.debug('{} has top parent {}'.format(proc, parents[-2]))
|
||||||
service_procs.add(parents[-2])
|
parent = parents[-2]
|
||||||
retest_procs.add(proc)
|
service_procs.add(parent)
|
||||||
|
retest_procs[proc] = parent
|
||||||
|
|
||||||
processes = {}
|
processes = {}
|
||||||
services = {}
|
services = {}
|
||||||
@ -114,7 +116,7 @@ def restart_services():
|
|||||||
service_name = conf.get('processes', proc_name, fallback=None)
|
service_name = conf.get('processes', proc_name, fallback=None)
|
||||||
if service_name == '':
|
if service_name == '':
|
||||||
log.debug('Ignoring process {}'.format(proc))
|
log.debug('Ignoring process {}'.format(proc))
|
||||||
retest_procs.remove(proc)
|
del retest_procs[proc]
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not service_name:
|
if not service_name:
|
||||||
@ -151,7 +153,7 @@ def restart_services():
|
|||||||
platform.restart_service(service)
|
platform.restart_service(service)
|
||||||
|
|
||||||
recommend_restart = False
|
recommend_restart = False
|
||||||
for proc in retest_procs:
|
for proc, parent in retest_procs.items():
|
||||||
try:
|
try:
|
||||||
name = proc.name()
|
name = proc.name()
|
||||||
except (psutil.NoSuchProcess, psutil.ZombieProcess, psutil.AccessDenied):
|
except (psutil.NoSuchProcess, psutil.ZombieProcess, psutil.AccessDenied):
|
||||||
@ -164,7 +166,7 @@ def restart_services():
|
|||||||
recommend_restart = True
|
recommend_restart = True
|
||||||
continue
|
continue
|
||||||
elif name in services:
|
elif name in services:
|
||||||
policy = _get_service_restart_policy(services[name])
|
policy = _get_service_restart_policy(services[parent.name()])
|
||||||
if policy in ('ignore', 'warn'):
|
if policy in ('ignore', 'warn'):
|
||||||
continue
|
continue
|
||||||
log.warning('{} still has deleted files open'.format(proc))
|
log.warning('{} still has deleted files open'.format(proc))
|
||||||
|
Loading…
Reference in New Issue
Block a user