backup: whitespace fixes

This commit is contained in:
Marek Marczykowski-Górecki 2013-11-09 17:06:29 +01:00
parent b84ba998a3
commit 89b6069bda

View File

@ -1027,7 +1027,7 @@ def backup_do_copy(base_backup_dir, files_to_backup, passphrase, progress_callba
qvm_collection = QubesVmCollection() qvm_collection = QubesVmCollection()
qvm_collection.lock_db_for_reading() qvm_collection.lock_db_for_reading()
qvm_collection.load() qvm_collection.load()
vm = qvm_collection.get_vm_by_name(appvm) vm = qvm_collection.get_vm_by_name(appvm)
if vm is None or vm.qid not in qvm_collection: if vm is None or vm.qid not in qvm_collection:
raise QubesException("VM {0} does not exist".format(appvm)) raise QubesException("VM {0} does not exist".format(appvm))
@ -1093,7 +1093,7 @@ def backup_do_copy(base_backup_dir, files_to_backup, passphrase, progress_callba
tar_final_cmd = ["tar", "-cO", "--posix", "-C", self.base_dir, filename] tar_final_cmd = ["tar", "-cO", "--posix", "-C", self.base_dir, filename]
final_proc = subprocess.Popen (tar_final_cmd, stdin=subprocess.PIPE, stdout=self.backup_stdout) final_proc = subprocess.Popen (tar_final_cmd, stdin=subprocess.PIPE, stdout=self.backup_stdout)
final_proc.wait() final_proc.wait()
# Delete the file as we don't need it anymore # Delete the file as we don't need it anymore
print "Removing file",filename print "Removing file",filename
os.remove(filename) os.remove(filename)
@ -1148,7 +1148,7 @@ def backup_do_copy(base_backup_dir, files_to_backup, passphrase, progress_callba
chunkfile = backup_tempfile + "." + "%03d" % i chunkfile = backup_tempfile + "." + "%03d" % i
i += 1 i += 1
chunkfile_p = open(chunkfile,'wb') chunkfile_p = open(chunkfile,'wb')
if encrypt: if encrypt:
# Start encrypt # Start encrypt
# If no cipher is provided, the data is forwarded unencrypted !!! # If no cipher is provided, the data is forwarded unencrypted !!!
@ -1193,15 +1193,12 @@ def backup_do_copy(base_backup_dir, files_to_backup, passphrase, progress_callba
run_error="paused" run_error="paused"
else: else:
print "Finished tar sparse with error",tar_sparse.poll() print "Finished tar sparse with error",tar_sparse.poll()
pipe.close()
# Close the backup target and wait for it to finish pipe.close()
#backup_stdout.close()
to_send.put("FINISHED") to_send.put("FINISHED")
send_proc.join() send_proc.join()
if send_proc.exitcode != 0: if send_proc.exitcode != 0:
raise QubesException("Failed to send backup: error in the sending process") raise QubesException("Failed to send backup: error in the sending process")
@ -1380,7 +1377,7 @@ def restore_vm_dirs (backup_dir, backup_tmpdir, passphrase, vms_dirs, vms, vms_s
else: else:
self.print_callback("Releasing next chunck") self.print_callback("Releasing next chunck")
self.tar2_command.stdin.write("\n") self.tar2_command.stdin.write("\n")
# Delete the file as we don't need it anymore # Delete the file as we don't need it anymore
self.print_callback("Removing file "+filename) self.print_callback("Removing file "+filename)
os.remove(filename) os.remove(filename)
@ -1407,7 +1404,7 @@ def restore_vm_dirs (backup_dir, backup_tmpdir, passphrase, vms_dirs, vms, vms_s
qvm_collection = QubesVmCollection() qvm_collection = QubesVmCollection()
qvm_collection.lock_db_for_reading() qvm_collection.lock_db_for_reading()
qvm_collection.load() qvm_collection.load()
vm = qvm_collection.get_vm_by_name(appvm) vm = qvm_collection.get_vm_by_name(appvm)
if vm is None or vm.qid not in qvm_collection: if vm is None or vm.qid not in qvm_collection:
raise QubesException("VM {0} does not exist".format(appvm)) raise QubesException("VM {0} does not exist".format(appvm))
@ -1557,7 +1554,7 @@ def backup_restore_header(restore_target, passphrase, encrypt=False, appvm=None)
if vmproc.poll() != None: if vmproc.poll() != None:
error = vmproc.stderr.read() error = vmproc.stderr.read()
print error print error
print vmproc.poll(),command.poll() print vmproc.poll(),command.poll()
raise QubesException("ERROR: Immediate VM error while retrieving backup headers:{0}".format(error)) raise QubesException("ERROR: Immediate VM error while retrieving backup headers:{0}".format(error))
filename = "qubes.xml.000" filename = "qubes.xml.000"
@ -1651,7 +1648,7 @@ def backup_restore_prepare(backup_dir, qubes_xml, passphrase, options = {}, host
backup_collection = QubesVmCollection(store_filename = qubes_xml) backup_collection = QubesVmCollection(store_filename = qubes_xml)
backup_collection.lock_db_for_reading() backup_collection.lock_db_for_reading()
backup_collection.load() backup_collection.load()
if host_collection is None: if host_collection is None:
host_collection = QubesVmCollection() host_collection = QubesVmCollection()
host_collection.lock_db_for_reading() host_collection.lock_db_for_reading()