From 26adf050428d7debcaa9c7e6e8d69e11397c376b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Tue, 19 Apr 2016 20:24:49 +0200 Subject: [PATCH] [fix] Ensure that pending conf file is deleted after it's applied --- src/yunohost/service.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index 38726425..e82acae6 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -373,7 +373,6 @@ def service_regen_conf(names=[], with_diff=False, force=False, logger.debug("> system conf is not managed yet") if system_hash == new_hash: logger.debug("> no changes to system conf has been made") - os.remove(pending_path) conf_status = 'managed' regenerated = True elif force and to_remove: @@ -416,6 +415,8 @@ def service_regen_conf(names=[], with_diff=False, force=False, if regenerated: succeed_regen[system_path] = conf_result conf_hashes[system_path] = new_hash + if os.path.isfile(pending_path): + os.remove(pending_path) else: failed_regen[system_path] = conf_result @@ -650,7 +651,7 @@ def _process_regen_conf(system_conf, new_conf=None, save=True): system_dir = os.path.dirname(system_conf) if not os.path.isdir(system_dir): filesystem.mkdir(system_dir, 0755, True) - shutil.move(new_conf, system_conf) + shutil.copy2(new_conf, system_conf) logger.info(m18n.n('service_conf_file_updated', conf=system_conf)) except: