refactor(backup): extract rclone args

This commit is contained in:
Houkime 2023-01-18 09:40:04 +00:00
parent 2d761f7311
commit c7f304744c

View file

@ -90,7 +90,7 @@ class ResticController(metaclass=SingletonMetaclass):
backup_listing_command = [ backup_listing_command = [
"restic", "restic",
"-o", "-o",
"rclone.args=serve restic --stdio", self.rclone_args(),
"-r", "-r",
f"rclone:backblaze:{self._repository_name}/sfbackup", f"rclone:backblaze:{self._repository_name}/sfbackup",
"snapshots", "snapshots",
@ -122,6 +122,9 @@ class ResticController(metaclass=SingletonMetaclass):
self.error_message = snapshots_list self.error_message = snapshots_list
return return
def rclone_args(self):
return "rclone.args=serve restic --stdio"
def initialize_repository(self): def initialize_repository(self):
""" """
Initialize repository with restic Initialize repository with restic
@ -129,7 +132,7 @@ class ResticController(metaclass=SingletonMetaclass):
initialize_repository_command = [ initialize_repository_command = [
"restic", "restic",
"-o", "-o",
"rclone.args=serve restic --stdio", self.rclone_args(),
"-r", "-r",
f"rclone:backblaze:{self._repository_name}/sfbackup", f"rclone:backblaze:{self._repository_name}/sfbackup",
"init", "init",
@ -158,7 +161,7 @@ class ResticController(metaclass=SingletonMetaclass):
backup_command = [ backup_command = [
"restic", "restic",
"-o", "-o",
"rclone.args=serve restic --stdio", self.rclone_args(),
"-r", "-r",
f"rclone:backblaze:{self._repository_name}/sfbackup", f"rclone:backblaze:{self._repository_name}/sfbackup",
"--verbose", "--verbose",
@ -227,7 +230,7 @@ class ResticController(metaclass=SingletonMetaclass):
backup_restoration_command = [ backup_restoration_command = [
"restic", "restic",
"-o", "-o",
"rclone.args=serve restic --stdio", self.rclone_args(),
"-r", "-r",
f"rclone:backblaze:{self._repository_name}/sfbackup", f"rclone:backblaze:{self._repository_name}/sfbackup",
"restore", "restore",