mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-24 13:01:28 +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,
|
repo_name,
|
||||||
"init",
|
"init",
|
||||||
)
|
)
|
||||||
subprocess.Popen(
|
with subprocess.Popen(
|
||||||
init_command,
|
init_command,
|
||||||
shell=False,
|
shell=False,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
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):
|
def restore_from_backup(self, repo_name, snapshot_id, folder):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue