fixed default_service_policy setting

This commit is contained in:
Fredrik Eriksson 2019-04-28 07:50:14 +02:00
parent 45eefb251b
commit 10d1999340
No known key found for this signature in database
GPG Key ID: 8825C73A0FD1502A

View File

@ -172,6 +172,7 @@ def restart_services():
return recommend_restart return recommend_restart
def _get_service_restart_policy(service): def _get_service_restart_policy(service):
log = logging.getLogger(sau.LOGNAME)
conf = sau.config conf = sau.config
policy = conf.get('services', service, fallback=None) policy = conf.get('services', service, fallback=None)
if policy and policy.lower() in ('restart', 'warn', 'ignore', 'silent-restart'): if policy and policy.lower() in ('restart', 'warn', 'ignore', 'silent-restart'):
@ -179,7 +180,7 @@ def _get_service_restart_policy(service):
elif policy: elif policy:
log.warning('service policy {} for {} is invalid'.format(policy, service)) log.warning('service policy {} for {} is invalid'.format(policy, service))
default_policy = conf.get('services', 'default_service_policy', fallback='warn') default_policy = conf.get('default', 'default_service_policy', fallback='warn')
if default_policy.lower() in ('restart', 'warn', 'ignore', 'silent-restart'): if default_policy.lower() in ('restart', 'warn', 'ignore', 'silent-restart'):
return default_policy.lower() return default_policy.lower()
log.warning('default service policy {} is invalid'.format(default_policy)) log.warning('default service policy {} is invalid'.format(default_policy))