From f1866c6113f3f591f6443d62641ea7e2e932c372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Sun, 1 May 2016 13:41:54 +0200 Subject: [PATCH] [enh] Do not clean whole pending conf dir when names are given at regen-conf --- src/yunohost/service.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index 54cbe264c..082a74d15 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -300,8 +300,15 @@ def service_regen_conf(names=[], with_diff=False, force=False, dry_run=False, return pending_conf # Clean pending conf directory - shutil.rmtree(pending_conf_dir, ignore_errors=True) - filesystem.mkdir(pending_conf_dir, 0755, True) + if os.path.isdir(pending_conf_dir): + if not names: + shutil.rmtree(pending_conf_dir, ignore_errors=True) + else: + for name in names: + shutil.rmtree(os.path.join(pending_conf_dir, name), + ignore_errors=True) + else: + filesystem.mkdir(pending_conf_dir, 0755, True) # Format common hooks arguments common_args = [1 if force else 0, 1 if dry_run else 0]