From 2fc016e3e5d74fc6fd4ed3158c6b025087f329bd Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 22 Jan 2021 03:32:27 +0100 Subject: [PATCH] Make sure tmp_script exists .. --- src/yunohost/backup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/yunohost/backup.py b/src/yunohost/backup.py index 242cd0bfd..dbad45746 100644 --- a/src/yunohost/backup.py +++ b/src/yunohost/backup.py @@ -673,6 +673,7 @@ class BackupManager(): settings_dir = os.path.join(self.work_dir, 'apps', app, 'settings') logger.info(m18n.n("app_start_backup", app=app)) + tmp_script = None # This is to make sure the var exists later in the 'finally' ... try: # Prepare backup directory for the app filesystem.mkdir(tmp_app_bkp_dir, 0o750, True, uid='admin') @@ -713,7 +714,8 @@ class BackupManager(): # Remove tmp files in all situations finally: - filesystem.rm(tmp_script, force=True) + if tmp_script: + filesystem.rm(tmp_script, force=True) filesystem.rm(env_dict["YNH_BACKUP_CSV"], force=True) #