backups: unify compress/encrypt parameter names

This commit is contained in:
Marek Marczykowski-Górecki 2014-01-15 03:45:12 +01:00
parent 8d445beebb
commit 4b493b6d9a
2 changed files with 8 additions and 8 deletions

View File

@ -343,8 +343,8 @@ class SendWorker(Process):
print "Finished sending thread" print "Finished sending thread"
def backup_do(base_backup_dir, files_to_backup, passphrase, def backup_do(base_backup_dir, files_to_backup, passphrase,
progress_callback = None, encrypt=False, appvm=None, progress_callback = None, encrypted=False, appvm=None,
compress = False): compressed=False):
total_backup_sz = 0 total_backup_sz = 0
for file in files_to_backup: for file in files_to_backup:
total_backup_sz += file["size"] total_backup_sz += file["size"]
@ -466,19 +466,19 @@ def backup_do(base_backup_dir, files_to_backup, passphrase,
'addproc': tar_sparse, 'addproc': tar_sparse,
'progress_callback': compute_progress, 'progress_callback': compute_progress,
} }
if encrypt: if encrypted:
# Start encrypt # Start encrypt
# If no cipher is provided, the data is forwarded unencrypted !!! # If no cipher is provided, the data is forwarded unencrypted !!!
encryptor = subprocess.Popen (["openssl", "enc", encryptor = subprocess.Popen (["openssl", "enc",
"-e", "-aes-256-cbc", "-e", "-aes-256-cbc",
"-pass", "pass:"+passphrase] + "-pass", "pass:"+passphrase] +
(["-z"] if compress else []), (["-z"] if compressed else []),
stdin=pipe, stdout=subprocess.PIPE) stdin=pipe, stdout=subprocess.PIPE)
run_error = wait_backup_feedback( run_error = wait_backup_feedback(
in_stream=encryptor.stdout, streamproc=encryptor, in_stream=encryptor.stdout, streamproc=encryptor,
**common_args) **common_args)
elif compress: elif compressed:
compressor = subprocess.Popen (["gzip"], compressor = subprocess.Popen (["gzip"],
stdin=pipe, stdout=subprocess.PIPE) stdin=pipe, stdout=subprocess.PIPE)
run_error = wait_backup_feedback( run_error = wait_backup_feedback(
in_stream=compressor.stdout, streamproc=compressor, in_stream=compressor.stdout, streamproc=compressor,

View File

@ -123,8 +123,8 @@ def main():
try: try:
backup_do(base_backup_dir, files_to_backup, passphrase, backup_do(base_backup_dir, files_to_backup, passphrase,
progress_callback=print_progress, progress_callback=print_progress,
encrypt=options.encrypt, encrypted=options.encrypt,
compress=options.compress, compressed=options.compress,
appvm=appvm) appvm=appvm)
except QubesException as e: except QubesException as e:
print >>sys.stderr, "ERROR: %s" % str(e) print >>sys.stderr, "ERROR: %s" % str(e)