From 487195853411c83ad74901ef955b135e5c6af9b7 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Wed, 18 Jan 2023 09:49:02 +0000 Subject: [PATCH] refactor(backup): extract restic repo --- selfprivacy_api/restic_controller/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/selfprivacy_api/restic_controller/__init__.py b/selfprivacy_api/restic_controller/__init__.py index a5a6634..592b651 100644 --- a/selfprivacy_api/restic_controller/__init__.py +++ b/selfprivacy_api/restic_controller/__init__.py @@ -92,7 +92,7 @@ class ResticController(metaclass=SingletonMetaclass): "-o", self.rclone_args(), "-r", - f"rclone:backblaze:{self._repository_name}/sfbackup", + self.restic_repo(), "snapshots", "--json", ] @@ -122,6 +122,9 @@ class ResticController(metaclass=SingletonMetaclass): self.error_message = snapshots_list return + def restic_repo(self): + return f"rclone:backblaze:{self._repository_name}/sfbackup" + def rclone_args(self): return "rclone.args=serve restic --stdio" @@ -134,7 +137,7 @@ class ResticController(metaclass=SingletonMetaclass): "-o", self.rclone_args(), "-r", - f"rclone:backblaze:{self._repository_name}/sfbackup", + self.restic_repo(), "init", ] with subprocess.Popen( @@ -163,7 +166,7 @@ class ResticController(metaclass=SingletonMetaclass): "-o", self.rclone_args(), "-r", - f"rclone:backblaze:{self._repository_name}/sfbackup", + self.restic_repo(), "--verbose", "--json", "backup", @@ -232,7 +235,7 @@ class ResticController(metaclass=SingletonMetaclass): "-o", self.rclone_args(), "-r", - f"rclone:backblaze:{self._repository_name}/sfbackup", + self.restic_repo(), "restore", snapshot_id, "--target",