do not re-test ignored processes

This commit is contained in:
Fredrik Eriksson 2024-08-03 07:04:14 +02:00
parent 7cce11022c
commit db865eafe9
Signed by: feffe
GPG Key ID: E6B5580B853D322B

View File

@ -116,7 +116,6 @@ def restart_services():
retest_procs.add(proc) retest_procs.add(proc)
recommend_restart = False recommend_restart = False
processes = {}
services = {} services = {}
for proc in service_procs: for proc in service_procs:
if not proc: if not proc:
@ -141,15 +140,17 @@ def restart_services():
sau.helpers.exec_cmd([ '/usr/bin/systemctl', 'daemon-reexec' ]) sau.helpers.exec_cmd([ '/usr/bin/systemctl', 'daemon-reexec' ])
continue continue
elif service_name == '@ignore': elif service_name == '@ignore':
log.info(f"Process {proc} ignored by configuration")
retest_procs.discard(proc)
continue continue
services[proc_name] = service_name services[proc_name] = service_name
processes[service_name] = [proc]
for service in set([x for x in services.values() if x]): for service in set([x for x in services.values() if x]):
policy = _get_service_restart_policy(service) policy = _get_service_restart_policy(service)
if policy == 'ignore': if policy == 'ignore':
log.info('Service "{}" ignored by configuration'.format(service)) log.info('Service "{}" ignored by configuration'.format(service))
[retest_procs.discard(x) for x,y in services.items() if y == service]
continue continue
elif policy == 'warn': elif policy == 'warn':
log.warning('Service "{}" has open deleted files and should be restarted'.format(service)) log.warning('Service "{}" has open deleted files and should be restarted'.format(service))