From e857f4f0b27d71299c498305b24e4b3f7e4571c4 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 19 Dec 2016 12:17:27 -0500 Subject: [PATCH 1/3] [mod] Cleaner logs for _get_conf_hashes --- src/yunohost/service.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index dcd3dee83..2d9068180 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -639,12 +639,17 @@ def _get_pending_conf(services=[]): def _get_conf_hashes(service): """Get the registered conf hashes for a service""" - try: - return _get_services()[service]['conffiles'] - except: - logger.debug("unable to retrieve conf hashes for %s", - service, exc_info=1) + + d = _get_services() + + if (service not in d.keys()): + logger.debug("Service %s is not in services.yml yet.", service) return {} + elif ('conffiles' not in d[service].keys()): + logger.debug("No configuration files for service %s.", service) + return {} + else: + return d[service]['conffiles'] def _update_conf_hashes(service, hashes): From 5b7536cf1036cecee6fcc187b2d1c3f9b7124093 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 19 Dec 2016 12:18:28 -0500 Subject: [PATCH 2/3] Style for Bram :) --- src/yunohost/service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index 2d9068180..f17edd567 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -642,10 +642,10 @@ def _get_conf_hashes(service): d = _get_services() - if (service not in d.keys()): + if service not in d.keys(): logger.debug("Service %s is not in services.yml yet.", service) return {} - elif ('conffiles' not in d[service].keys()): + elif 'conffiles' not in d[service].keys(): logger.debug("No configuration files for service %s.", service) return {} else: From 0b6ccaf31a8301b50648ec0ba0473d2190384355 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 19 Dec 2016 18:24:01 -0500 Subject: [PATCH 3/3] Implementing comments --- src/yunohost/service.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index f17edd567..01b85dfbe 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -640,16 +640,16 @@ def _get_pending_conf(services=[]): def _get_conf_hashes(service): """Get the registered conf hashes for a service""" - d = _get_services() + services = _get_services() - if service not in d.keys(): + if service not in services: logger.debug("Service %s is not in services.yml yet.", service) return {} - elif 'conffiles' not in d[service].keys(): + elif 'conffiles' not in services[service]: logger.debug("No configuration files for service %s.", service) return {} else: - return d[service]['conffiles'] + return services[service]['conffiles'] def _update_conf_hashes(service, hashes):