mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-26 14:01:30 +00:00
feat(backups): throw an error on a failed backup
This commit is contained in:
parent
01797cb922
commit
b3633d1a96
|
@ -65,21 +65,15 @@ class ResticBackuper(AbstractBackuper):
|
||||||
"backup",
|
"backup",
|
||||||
folder,
|
folder,
|
||||||
)
|
)
|
||||||
subprocess.Popen(
|
with subprocess.Popen(
|
||||||
backup_command,
|
backup_command,
|
||||||
shell=False,
|
shell=False,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
)
|
) as handle:
|
||||||
|
output = handle.communicate()[0].decode("utf-8")
|
||||||
# TODO: we might want to provide logging facilities
|
if "saved" not in output:
|
||||||
# that are reroutable for testing
|
raise ValueError("could not create a new snapshot: " + output)
|
||||||
# with open("/var/backup.log", "w", encoding="utf-8") as log_file:
|
|
||||||
# subprocess.Popen(
|
|
||||||
# backup_command,
|
|
||||||
# shell=False,
|
|
||||||
# stdout=log_file,
|
|
||||||
# stderr=subprocess.STDOUT,
|
|
||||||
# )
|
|
||||||
|
|
||||||
def init(self, repo_name):
|
def init(self, repo_name):
|
||||||
init_command = self.restic_command(
|
init_command = self.restic_command(
|
||||||
|
|
Loading…
Reference in a new issue