Raise meaningful error when Borg version found is too old. Fixes #283 (#287)

* Raise meaningful error when Borg version found is too old. Fixes #283

* Start with compatible Borg version to pass tests.
This commit is contained in:
Manuel Riel 2019-06-11 08:20:19 +08:00 committed by GitHub
parent 3aa3d96360
commit 85e4d9d163
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -3,6 +3,7 @@ from pkg_resources import parse_version
MIN_BORG_FOR_FEATURE = {
'BLAKE2': parse_version('1.1.4'),
'ZSTD': parse_version('1.1.4'),
'JSON_LOG': parse_version('1.1.0')
# add new version-checks here.
}
@ -14,7 +15,7 @@ class BorgCompatibility:
to customize Borg commands by version in the future.
"""
version = '0.0'
version = '1.1.0'
path = ''
def set_version(self, version, path):

View File

@ -13,7 +13,7 @@ from subprocess import Popen, PIPE
from vorta.i18n import trans_late
from vorta.models import EventLogModel, BackupProfileMixin
from vorta.utils import keyring
from vorta.utils import keyring, borg_compat
from vorta.keyring.db import VortaDBKeyring
mutex = QtCore.QMutex()
@ -109,6 +109,10 @@ class BorgThread(QtCore.QThread, BackupProfileMixin):
ret['message'] = trans_late('messages', 'Add a backup repository first.')
return ret
if not borg_compat.check('JSON_LOG'):
ret['message'] = trans_late('messages', 'Your Borg version is too old. >=1.1.0 is required.')
return ret
# Try to get password from chosen keyring backend.
logger.debug("Using %s keyring to store passwords.", keyring.__class__.__name__)
ret['password'] = keyring.get_password('vorta-repo', profile.repo.url)