Pre-backup command runs before repository checks, that allows to mount repository folder before backup starting (#264)

This commit is contained in:
rossomah 2019-04-24 09:05:54 +03:00 committed by Manuel Riel
parent 893cbc0d5c
commit a83ad6352e
1 changed files with 7 additions and 7 deletions

View File

@ -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