feature(backups): check restore exit code
continuous-integration/drone/push Build is failing Details

pull/35/head
Houkime 2023-07-03 20:53:21 +00:00
parent 3dc6fb91f2
commit 03313b739a
1 changed files with 9 additions and 1 deletions

View File

@ -219,7 +219,7 @@ class ResticBackupper(AbstractBackupper):
raise ValueError("cannot restore without knowing where to!")
with tempfile.TemporaryDirectory() as dir:
self.do_restore(snapshot_id, target=dir)
self.do_restore(snapshot_id, target=dir, verify=verify)
for folder in folders:
src = join(dir, folder.strip("/"))
if not exists(src):
@ -249,6 +249,14 @@ class ResticBackupper(AbstractBackupper):
if "restoring" not in output:
raise ValueError("cannot restore a snapshot: " + output)
assert (
handle.returncode is not None
) # none should be impossible after communicate
if handle.returncode != 0:
raise ValueError(
"restore exited with errorcode", returncode, ":", output
)
def _load_snapshots(self) -> object:
"""
Load list of snapshots from repository