From 5abcaadaeabdd60b40baf6e79fff3273c1dd6108 Mon Sep 17 00:00:00 2001 From: ZeHiro Date: Sun, 12 Feb 2017 12:16:54 +0100 Subject: [PATCH 1/3] [fix] handle the case where services[service] is set to null in the services.yml. Fix #785 --- src/yunohost/service.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index 01b85dfbe..a45a9164a 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -658,6 +658,11 @@ def _update_conf_hashes(service, hashes): service, hashes) services = _get_services() service_conf = services.get(service, {}) + + # Handle the case where services[service] is set to null in the yaml + if service_conf is None: + service_conf = {} + service_conf['conffiles'] = hashes services[service] = service_conf _save_services(services) From 0e55b17665cf1cd05c157950cbc5601421910a2e Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 12 Feb 2017 18:49:59 -0500 Subject: [PATCH 2/3] Fixing also get_conf_hashes --- src/yunohost/service.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index a45a9164a..e3812f3db 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -645,7 +645,8 @@ def _get_conf_hashes(service): if service not in services: logger.debug("Service %s is not in services.yml yet.", service) return {} - elif 'conffiles' not in services[service]: + + if (services[service] is None) or ('conffiles' not in services[service]): logger.debug("No configuration files for service %s.", service) return {} else: From 834cf459dcd544919f893e73c6be6a471c7e0554 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 19 Feb 2017 20:15:37 +0100 Subject: [PATCH 3/3] Please Bram :D --- src/yunohost/service.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index e3812f3db..17d5e50ab 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -645,8 +645,7 @@ def _get_conf_hashes(service): if service not in services: logger.debug("Service %s is not in services.yml yet.", service) return {} - - if (services[service] is None) or ('conffiles' not in services[service]): + elif services[service] is None or 'conffiles' not in services[service]: logger.debug("No configuration files for service %s.", service) return {} else: