mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-23 01:06:43 +00:00
feature(backups): throw an error if repo init fails
This commit is contained in:
parent
b27f19b201
commit
add4e21f39
|
@ -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):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue