mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 12:11:26 +00:00
refactor(backups): make localfile repos normal
This commit is contained in:
parent
cbedd196e4
commit
9e0b0d8caa
|
@ -31,8 +31,7 @@ class Backups:
|
|||
@staticmethod
|
||||
def set_localfile_repo(file_path: str):
|
||||
ProviderClass = get_provider(BackupProvider.FILE)
|
||||
provider = ProviderClass(file_path)
|
||||
Storage.store_testrepo_path(file_path)
|
||||
provider = ProviderClass(login="", key="", location=file_path, repo_id="")
|
||||
Storage.store_provider(provider)
|
||||
|
||||
def set_provider(provider: AbstractBackupProvider):
|
||||
|
@ -145,10 +144,6 @@ class Backups:
|
|||
):
|
||||
provider_class = get_provider(BackupProvider[kind])
|
||||
|
||||
if kind == "FILE":
|
||||
path = Storage.get_testrepo_path()
|
||||
return provider_class(path)
|
||||
|
||||
return provider_class(login=login, key=key, location=location, repo_id=repo_id)
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -3,12 +3,5 @@ from selfprivacy_api.backup.restic_backuper import ResticBackuper
|
|||
|
||||
|
||||
class LocalFileBackup(AbstractBackupProvider):
|
||||
backuper = ResticBackuper("", "", "memory")
|
||||
|
||||
backuper = ResticBackuper("", "", ":local:")
|
||||
name = "FILE"
|
||||
|
||||
# login and key args are for compatibility with generic provider methods. They are ignored.
|
||||
def __init__(self, filename: str, login: str = "", key: str = ""):
|
||||
super().__init__()
|
||||
self.backuper = ResticBackuper("", "", ":local:")
|
||||
self.backuper.set_creds("", "", filename)
|
||||
|
|
|
@ -95,7 +95,7 @@ def file_backup(tmpdir) -> AbstractBackupProvider:
|
|||
test_repo_path = path.join(tmpdir, "test_repo")
|
||||
ProviderClass = providers.get_provider(BackupProvider.FILE)
|
||||
assert ProviderClass is not None
|
||||
provider = ProviderClass(test_repo_path)
|
||||
provider = ProviderClass(location=test_repo_path)
|
||||
assert provider is not None
|
||||
return provider
|
||||
|
||||
|
|
Loading…
Reference in a new issue