From 3f0ad9139ea6ae6d9d30777e0f8964fabd891bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Sun, 1 May 2016 13:46:27 +0200 Subject: [PATCH] [enh] Remove empty pending conf directory at regen-conf --- src/yunohost/service.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index 082a74d15..ab26dd2bc 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -617,15 +617,20 @@ def _get_pending_conf(services=[]): if not services: services = os.listdir(pending_conf_dir) for name in services: - service_conf = {} service_pending_path = os.path.join(pending_conf_dir, name) + if not os.path.isdir(service_pending_path): + continue path_index = len(service_pending_path) + service_conf = {} for root, dirs, files in os.walk(service_pending_path): for filename in files: pending_path = os.path.join(root, filename) service_conf[pending_path[path_index:]] = pending_path if service_conf: result[name] = service_conf + else: + # remove empty directory + shutil.rmtree(service_pending_path, ignore_errors=True) return result