backups: improve errors handling
Report nice error message (not a traceback), interrupt the process on non-recoverable error (when extraction process is already dead).
This commit is contained in:
parent
f0bbb28398
commit
228ae07543
@ -742,7 +742,13 @@ def wait_backup_feedback(progress_callback, in_stream, streamproc,
|
|||||||
if len(buffer) <= 0:
|
if len(buffer) <= 0:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
backup_target.write(buffer)
|
try:
|
||||||
|
backup_target.write(buffer)
|
||||||
|
except IOError as e:
|
||||||
|
if e.errno == errno.EPIPE:
|
||||||
|
run_error = "target"
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
if hmac:
|
if hmac:
|
||||||
hmac.stdin.write(buffer)
|
hmac.stdin.write(buffer)
|
||||||
@ -1145,6 +1151,15 @@ def restore_vm_dirs (backup_source, restore_tmpdir, passphrase, vms_dirs, vms,
|
|||||||
while True:
|
while True:
|
||||||
if running_backup_operation and running_backup_operation.canceled:
|
if running_backup_operation and running_backup_operation.canceled:
|
||||||
break
|
break
|
||||||
|
if not extract_proc.is_alive():
|
||||||
|
command.terminate()
|
||||||
|
command.wait()
|
||||||
|
expect_tar_error = True
|
||||||
|
if vmproc:
|
||||||
|
vmproc.terminate()
|
||||||
|
vmproc.wait()
|
||||||
|
vmproc = None
|
||||||
|
break
|
||||||
if nextfile is not None:
|
if nextfile is not None:
|
||||||
filename = nextfile
|
filename = nextfile
|
||||||
else:
|
else:
|
||||||
|
@ -227,8 +227,11 @@ def main():
|
|||||||
exit (0)
|
exit (0)
|
||||||
|
|
||||||
|
|
||||||
backup_restore_do(restore_info,
|
try:
|
||||||
host_collection=host_collection)
|
backup_restore_do(restore_info,
|
||||||
|
host_collection=host_collection)
|
||||||
|
except QubesException as e:
|
||||||
|
print >> sys.stderr, "ERROR: %s" % str(e)
|
||||||
|
|
||||||
host_collection.unlock_db()
|
host_collection.unlock_db()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user