From a83ad6352e2b572a423eab3ec0993e29df48c283 Mon Sep 17 00:00:00 2001 From: rossomah <49760009+rossomah@users.noreply.github.com> Date: Wed, 24 Apr 2019 09:05:54 +0300 Subject: [PATCH] Pre-backup command runs before repository checks, that allows to mount repository folder before backup starting (#264) --- src/vorta/borg/create.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/vorta/borg/create.py b/src/vorta/borg/create.py index f32f1582..82250713 100644 --- a/src/vorta/borg/create.py +++ b/src/vorta/borg/create.py @@ -92,6 +92,13 @@ class BorgCreateThread(BorgThread): if wifi_is_disallowed.count() > 0 and profile.repo.is_remote_repo(): ret['message'] = trans_late('messages', 'Current Wifi is not allowed.') return ret + ret['profile'] = profile + ret['repo'] = profile.repo + + # Run user-supplied pre-backup command + if cls.pre_post_backup_cmd(ret) != 0: + ret['message'] = trans_late('messages', 'Pre-backup command returned non-zero exit code.') + return ret if not profile.repo.is_remote_repo() and not os.path.exists(profile.repo.url): ret['message'] = trans_late('messages', 'Repo folder not mounted or moved.') @@ -130,13 +137,6 @@ class BorgCreateThread(BorgThread): for f in SourceFileModel.select().where(SourceFileModel.profile == profile.id): cmd.append(f.dir) - # Run user-supplied pre-backup command - ret['profile'] = profile - ret['repo'] = profile.repo - if cls.pre_post_backup_cmd(ret) != 0: - ret['message'] = trans_late('messages', 'Pre-backup command returned non-zero exit code.') - return ret - ret['message'] = trans_late('messages', 'Starting backup...') ret['ok'] = True ret['cmd'] = cmd