fix warnings

This commit is contained in:
Fredrik Eriksson 2019-12-16 20:33:41 +01:00
parent 1322918dcc
commit aadd0e2641
Signed by: feffe
GPG Key ID: 18524638BE25530A

View File

@ -122,9 +122,9 @@ def restart_services():
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))
continue continue
elif 'reboot' in policy: elif 'reboot' in policy:
_warn('Rebooting because {} has opened files'.format(service)) _warn(policy, 'Rebooting because {} has opened files'.format(service))
recommend_restart = True recommend_restart = True
_warn('Restarting service {}'.format(service)) _warn(policy, 'Restarting service {}'.format(service))
platform.restart_service(service) platform.restart_service(service)
tested_parents = set() tested_parents = set()
@ -142,13 +142,13 @@ def restart_services():
service = _get_service_from_proc(parent) service = _get_service_from_proc(parent)
policy = _get_service_restart_policy(service) policy = _get_service_restart_policy(service)
if not service: if not service:
_warn('could not re-check process {} - failed to identify service'.format(proc)) _warn(policy, 'could not re-check process {} - failed to identify service'.format(proc))
recommend_restart = True recommend_restart = True
continue continue
log.debug('{} is in service {}'.format(proc, service)) log.debug('{} is in service {}'.format(proc, service))
if parent_name in services and not services[parent_name]: if parent_name in services and not services[parent_name]:
_warn('{} (parent {}) does not belong to a service and could not be restarted'.format(proc, parent)) _warn(policy, '{} (parent {}) does not belong to a service and could not be restarted'.format(proc, parent))
recommend_restart = True recommend_restart = True
continue continue
elif parent_name in services: elif parent_name in services:
@ -156,7 +156,7 @@ def restart_services():
log.debug('service {} has policy {}'.format(service, policy)) log.debug('service {} has policy {}'.format(service, policy))
if policy in ('ignore', 'warn'): if policy in ('ignore', 'warn'):
continue continue
_warn('{} (parent {}) still has deleted files open'.format(proc, parent)) _warn(policy, '{} (parent {}) still has deleted files open'.format(proc, parent))
recommend_restart = True recommend_restart = True
return recommend_restart return recommend_restart