backups/qvm-backup: show all warnings at one place, clarify pass phrase prompt (#801)

This commit is contained in:
Marek Marczykowski-Górecki 2014-03-17 21:26:42 +01:00
parent 5d7688a2fe
commit dda1bbc41a

View File

@ -85,8 +85,6 @@ def main():
vms = [qvm_collection.get_vm_by_name(vmname) for vmname in args[1:]] vms = [qvm_collection.get_vm_by_name(vmname) for vmname in args[1:]]
if options.appvm: if options.appvm:
print >>sys.stderr, ("WARNING: VM {} excluded because it's used to "
"store the backup.").format(options.appvm)
options.exclude_list.append(options.appvm) options.exclude_list.append(options.appvm)
if options.appvm or options.crypto_algorithm: if options.appvm or options.crypto_algorithm:
@ -135,11 +133,26 @@ def main():
if not appvm.is_running(): if not appvm.is_running():
appvm.start(verbose=True) appvm.start(verbose=True)
if options.appvm:
print >>sys.stderr, ("WARNING: VM {} excluded because it's used to "
"store the backup.").format(options.appvm)
options.exclude_list.append(options.appvm)
if not options.encrypt:
print >>sys.stderr, "WARNING: encryption will not be used"
prompt = raw_input ("Do you want to proceed? [y/N] ") prompt = raw_input ("Do you want to proceed? [y/N] ")
if not (prompt == "y" or prompt == "Y"): if not (prompt == "y" or prompt == "Y"):
exit (0) exit (0)
passphrase = getpass.getpass("Please enter the pass phrase that will be used to encrypt/verify the backup: ") if options.encrypt:
passphrase = getpass.getpass("Please enter the pass phrase that will "
"be used to encrypt and verify the "
"backup: ")
else:
passphrase = getpass.getpass("Please enter the pass phrase that will "
"be used to verify the backup: ")
passphrase2 = getpass.getpass("Enter again for verification: ") passphrase2 = getpass.getpass("Enter again for verification: ")
if passphrase != passphrase2: if passphrase != passphrase2:
print >>sys.stderr, "ERROR: Password mismatch" print >>sys.stderr, "ERROR: Password mismatch"