Fix verify-only
This commit is contained in:
parent
6fe5f8c0e7
commit
f86c640d65
@ -1357,9 +1357,10 @@ class BackupRestore(object):
|
|||||||
# This all means that if the file was correctly verified
|
# This all means that if the file was correctly verified
|
||||||
# + decrypted, we will surely access the right file
|
# + decrypted, we will surely access the right file
|
||||||
filename = self._verify_and_decrypt(filename)
|
filename = self._verify_and_decrypt(filename)
|
||||||
|
|
||||||
if not self.options.verify_only:
|
if not self.options.verify_only:
|
||||||
to_extract.put(os.path.join(self.tmpdir, filename))
|
to_extract.put(os.path.join(self.tmpdir, filename))
|
||||||
|
else:
|
||||||
|
os.unlink(os.path.join(self.tmpdir, filename))
|
||||||
|
|
||||||
if self.canceled:
|
if self.canceled:
|
||||||
raise BackupCanceledError("Restore canceled",
|
raise BackupCanceledError("Restore canceled",
|
||||||
@ -1783,20 +1784,18 @@ class BackupRestore(object):
|
|||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
self.log.error('Error extracting data: ' + str(err))
|
self.log.error('Error extracting data: ' + str(err))
|
||||||
self.log.warning(
|
finally:
|
||||||
"Continuing anyway to restore at least some VMs")
|
if self.log.getEffectiveLevel() > logging.DEBUG:
|
||||||
|
shutil.rmtree(self.tmpdir)
|
||||||
if self.options.verify_only:
|
|
||||||
shutil.rmtree(self.tmpdir)
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.canceled:
|
if self.canceled:
|
||||||
raise BackupCanceledError("Restore canceled",
|
raise BackupCanceledError("Restore canceled",
|
||||||
tmpdir=self.tmpdir)
|
tmpdir=self.tmpdir)
|
||||||
|
|
||||||
shutil.rmtree(self.tmpdir)
|
self.log.info("-> Done.")
|
||||||
self.log.info("-> Done. Please install updates for all the restored "
|
if not self.options.verify_only:
|
||||||
"templates.")
|
self.log.info("-> Please install updates for all the restored "
|
||||||
|
"templates.")
|
||||||
|
|
||||||
def _restore_vms_metadata(self, restore_info):
|
def _restore_vms_metadata(self, restore_info):
|
||||||
'''Restore VM metadata
|
'''Restore VM metadata
|
||||||
@ -1817,7 +1816,10 @@ class BackupRestore(object):
|
|||||||
for vm in self._templates_first(vms.values()):
|
for vm in self._templates_first(vms.values()):
|
||||||
if self.canceled:
|
if self.canceled:
|
||||||
return
|
return
|
||||||
self.log.info("-> Restoring %s...", vm.name)
|
if self.options.verify_only:
|
||||||
|
self.log.info("-> Verifying %s...", vm.name)
|
||||||
|
else:
|
||||||
|
self.log.info("-> Restoring %s...", vm.name)
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
if vm.template:
|
if vm.template:
|
||||||
template = restore_info[vm.name].template
|
template = restore_info[vm.name].template
|
||||||
|
@ -134,8 +134,12 @@ def handle_broken(app, args, restore_info):
|
|||||||
"Or use --rename-conflicting to restore those VMs under "
|
"Or use --rename-conflicting to restore those VMs under "
|
||||||
"modified names (with numbers at the end).")
|
"modified names (with numbers at the end).")
|
||||||
|
|
||||||
app.log.info("The above VMs will be copied and added to your system.")
|
if args.verify_only:
|
||||||
app.log.info("Exisiting VMs will NOT be removed.")
|
app.log.info("The above VM archive(s) will be verified.")
|
||||||
|
app.log.info("Existing VMs will NOT be removed or altered.")
|
||||||
|
else:
|
||||||
|
app.log.info("The above VMs will be copied and added to your system.")
|
||||||
|
app.log.info("Exisiting VMs will NOT be removed.")
|
||||||
|
|
||||||
if there_are_missing_templates:
|
if there_are_missing_templates:
|
||||||
app.log.warning("*** One or more TemplateVMs are missing on the "
|
app.log.warning("*** One or more TemplateVMs are missing on the "
|
||||||
|
Loading…
Reference in New Issue
Block a user