mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-18 00:19:15 +00:00
refactor(backups): make localfile repos normal
This commit is contained in:
parent
a48856c9ad
commit
8475ae3375
|
@ -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")
|
||||
|
||||
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)
|
||||
backuper = ResticBackuper("", "", ":local:")
|
||||
name = "FILE"
|
|
@ -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