mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-24 04:51:27 +00:00
feature(backups): throw an error if repo init fails
This commit is contained in:
parent
d7f96a9adf
commit
7cb6ca9641
|
@ -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