mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 20:11:30 +00:00
refactor(backup): extract restic repo
This commit is contained in:
parent
060117a355
commit
4871958534
|
@ -92,7 +92,7 @@ class ResticController(metaclass=SingletonMetaclass):
|
||||||
"-o",
|
"-o",
|
||||||
self.rclone_args(),
|
self.rclone_args(),
|
||||||
"-r",
|
"-r",
|
||||||
f"rclone:backblaze:{self._repository_name}/sfbackup",
|
self.restic_repo(),
|
||||||
"snapshots",
|
"snapshots",
|
||||||
"--json",
|
"--json",
|
||||||
]
|
]
|
||||||
|
@ -122,6 +122,9 @@ class ResticController(metaclass=SingletonMetaclass):
|
||||||
self.error_message = snapshots_list
|
self.error_message = snapshots_list
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def restic_repo(self):
|
||||||
|
return f"rclone:backblaze:{self._repository_name}/sfbackup"
|
||||||
|
|
||||||
def rclone_args(self):
|
def rclone_args(self):
|
||||||
return "rclone.args=serve restic --stdio"
|
return "rclone.args=serve restic --stdio"
|
||||||
|
|
||||||
|
@ -134,7 +137,7 @@ class ResticController(metaclass=SingletonMetaclass):
|
||||||
"-o",
|
"-o",
|
||||||
self.rclone_args(),
|
self.rclone_args(),
|
||||||
"-r",
|
"-r",
|
||||||
f"rclone:backblaze:{self._repository_name}/sfbackup",
|
self.restic_repo(),
|
||||||
"init",
|
"init",
|
||||||
]
|
]
|
||||||
with subprocess.Popen(
|
with subprocess.Popen(
|
||||||
|
@ -163,7 +166,7 @@ class ResticController(metaclass=SingletonMetaclass):
|
||||||
"-o",
|
"-o",
|
||||||
self.rclone_args(),
|
self.rclone_args(),
|
||||||
"-r",
|
"-r",
|
||||||
f"rclone:backblaze:{self._repository_name}/sfbackup",
|
self.restic_repo(),
|
||||||
"--verbose",
|
"--verbose",
|
||||||
"--json",
|
"--json",
|
||||||
"backup",
|
"backup",
|
||||||
|
@ -232,7 +235,7 @@ class ResticController(metaclass=SingletonMetaclass):
|
||||||
"-o",
|
"-o",
|
||||||
self.rclone_args(),
|
self.rclone_args(),
|
||||||
"-r",
|
"-r",
|
||||||
f"rclone:backblaze:{self._repository_name}/sfbackup",
|
self.restic_repo(),
|
||||||
"restore",
|
"restore",
|
||||||
snapshot_id,
|
snapshot_id,
|
||||||
"--target",
|
"--target",
|
||||||
|
|
Loading…
Reference in a new issue