feature(backups): throw an error if repo init fails

pull/35/head
Houkime 2023-02-20 13:04:39 +00:00 committed by Inex Code
parent b27f19b201
commit add4e21f39
1 changed files with 6 additions and 2 deletions

View File

@ -86,11 +86,15 @@ class ResticBackuper(AbstractBackuper):
repo_name,
"init",
)
subprocess.Popen(
with subprocess.Popen(
init_command,
shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
) as process_handle:
output = process_handle.communicate()[0].decode("utf-8")
if not "created restic repository" in output:
raise ValueError("cannot init a repo: " + output)
def restore_from_backup(self, repo_name, snapshot_id, folder):
"""