fix(backups): Providers were not initialized corretly

This commit is contained in:
Inex Code 2023-06-23 14:36:16 +03:00
parent b86d0cd850
commit 1664f857ea
7 changed files with 9 additions and 20 deletions

View file

@ -6,8 +6,6 @@ from selfprivacy_api.graphql.queries.providers import (
class Backblaze(AbstractBackupProvider): class Backblaze(AbstractBackupProvider):
@property backuper = ResticBackuper("--b2-account", "--b2-key", ":b2:")
def backuper(self):
return ResticBackuper("--b2-account", "--b2-key", ":b2:")
name = BackupProviderEnum.BACKBLAZE name = BackupProviderEnum.BACKBLAZE

View file

@ -6,8 +6,6 @@ from selfprivacy_api.graphql.queries.providers import (
class LocalFileBackup(AbstractBackupProvider): class LocalFileBackup(AbstractBackupProvider):
@property backuper = ResticBackuper("", "", ":local:")
def backuper(self):
return ResticBackuper("", "", ":local:")
name = BackupProviderEnum.FILE name = BackupProviderEnum.FILE

View file

@ -6,8 +6,6 @@ from selfprivacy_api.graphql.queries.providers import (
class InMemoryBackup(AbstractBackupProvider): class InMemoryBackup(AbstractBackupProvider):
@property backuper = ResticBackuper("", "", ":memory:")
def backuper(self):
return ResticBackuper("", "", ":memory:")
name = BackupProviderEnum.MEMORY name = BackupProviderEnum.MEMORY

View file

@ -6,8 +6,6 @@ from selfprivacy_api.graphql.queries.providers import (
class NoBackups(AbstractBackupProvider): class NoBackups(AbstractBackupProvider):
@property backuper = NoneBackupper()
def backuper(self):
return NoneBackupper()
name = BackupProviderEnum.NONE name = BackupProviderEnum.NONE

View file

@ -11,10 +11,7 @@ from selfprivacy_api.graphql.queries.providers import (
class AbstractBackupProvider(ABC): class AbstractBackupProvider(ABC):
@property backuper: AbstractBackuper
@abstractmethod
def backuper(self) -> AbstractBackuper:
raise NotImplementedError
name: BackupProviderEnum name: BackupProviderEnum

View file

@ -59,7 +59,7 @@ class BackupMutations:
return GenericBackupConfigReturn( return GenericBackupConfigReturn(
success=True, success=True,
message="", message="",
code="200", code=200,
configuration=Backup().configuration(), configuration=Backup().configuration(),
) )
@ -70,7 +70,7 @@ class BackupMutations:
return GenericBackupConfigReturn( return GenericBackupConfigReturn(
success=True, success=True,
message="", message="",
code="200", code=200,
configuration=Backup().configuration(), configuration=Backup().configuration(),
) )
@ -87,7 +87,7 @@ class BackupMutations:
return GenericBackupConfigReturn( return GenericBackupConfigReturn(
success=True, success=True,
message="", message="",
code="200", code=200,
configuration=Backup().configuration(), configuration=Backup().configuration(),
) )

View file

@ -36,7 +36,7 @@ class Backup:
@strawberry.field @strawberry.field
def configuration(self) -> BackupConfiguration: def configuration(self) -> BackupConfiguration:
return BackupConfiguration( return BackupConfiguration(
provider=BackupProvider[Backups.provider().name], provider=Backups.provider().name,
encryption_key=LocalBackupSecret.get(), encryption_key=LocalBackupSecret.get(),
is_initialized=Backups.is_initted(), is_initialized=Backups.is_initted(),
autobackup_period=Backups.autobackup_period_minutes(), autobackup_period=Backups.autobackup_period_minutes(),