backup: do not show full stacktrace to the user

Opt for a simple one-liner error messages, instead of meaningless stack
trace (it's most of the time about qubesd responding with error, so the
stack trace of actual problem is elsewhere).
This commit is contained in:
Marek Marczykowski-Górecki 2017-07-17 19:32:30 +02:00
parent ca399c1a5a
commit ced735b476
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1731,7 +1731,7 @@ class BackupRestore(object):
['qvm-appmenus', '--set-whitelist=-', vm.name], ['qvm-appmenus', '--set-whitelist=-', vm.name],
stdin=stream) stdin=stream)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
self.log.exception('Failed to set application list for %s', vm.name) self.log.error('Failed to set application list for %s', vm.name)
def restore_do(self, restore_info): def restore_do(self, restore_info):
''' '''
@ -1845,8 +1845,9 @@ class BackupRestore(object):
label=vm.label, label=vm.label,
pool=self.options.override_pool, pool=self.options.override_pool,
**kwargs) **kwargs)
except Exception: # pylint: disable=broad-except except Exception as err: # pylint: disable=broad-except
self.log.exception('Error restoring VM %s, skipping', vm.name) self.log.error('Error restoring VM %s, skipping: %s',
vm.name, err)
if new_vm: if new_vm:
del self.app.domains[new_vm.name] del self.app.domains[new_vm.name]
continue continue
@ -1869,23 +1870,23 @@ class BackupRestore(object):
continue continue
try: try:
setattr(new_vm, prop, value) setattr(new_vm, prop, value)
except Exception: # pylint: disable=broad-except except Exception as err: # pylint: disable=broad-except
self.log.exception('Error setting %s.%s to %s', self.log.error('Error setting %s.%s to %s: %s',
vm.name, prop, value) vm.name, prop, value, err)
for feature, value in vm.features.items(): for feature, value in vm.features.items():
try: try:
new_vm.features[feature] = value new_vm.features[feature] = value
except Exception: # pylint: disable=broad-except except Exception as err: # pylint: disable=broad-except
self.log.exception('Error setting %s.features[%s] to %s', self.log.error('Error setting %s.features[%s] to %s: %s',
vm.name, feature, value) vm.name, feature, value, err)
for tag in vm.tags: for tag in vm.tags:
try: try:
new_vm.tags.add(tag) new_vm.tags.add(tag)
except Exception: # pylint: disable=broad-except except Exception as err: # pylint: disable=broad-except
self.log.exception('Error adding tag %s to %s', self.log.error('Error adding tag %s to %s: %s',
tag, vm.name) tag, vm.name, err)
for bus in vm.devices: for bus in vm.devices:
for backend_domain, ident in vm.devices[bus]: for backend_domain, ident in vm.devices[bus]:
@ -1897,9 +1898,9 @@ class BackupRestore(object):
persistent=True) persistent=True)
try: try:
new_vm.devices[bus].attach(assignment) new_vm.devices[bus].attach(assignment)
except Exception: # pylint: disable=broad-except except Exception as err: # pylint: disable=broad-except
self.log.exception('Error attaching device %s:%s to %s', self.log.error('Error attaching device %s:%s to %s: %s',
bus, ident, vm.name) bus, ident, vm.name, err)
# Set VM dependencies - only non-default setting # Set VM dependencies - only non-default setting
for vm in vms.values(): for vm in vms.values():
@ -1919,9 +1920,9 @@ class BackupRestore(object):
try: try:
host_vm.netvm = value host_vm.netvm = value
except Exception: # pylint: disable=broad-except except Exception as err: # pylint: disable=broad-except
self.log.exception('Error setting %s.%s to %s', self.log.error('Error setting %s.%s to %s: %s',
vm.name, 'netvm', value) vm.name, 'netvm', value, err)
if 'default_dispvm' in vm.properties: if 'default_dispvm' in vm.properties:
if vm.properties['default_dispvm'] in restore_info: if vm.properties['default_dispvm'] in restore_info:
@ -1932,6 +1933,6 @@ class BackupRestore(object):
try: try:
host_vm.default_dispvm = value host_vm.default_dispvm = value
except Exception: # pylint: disable=broad-except except Exception as err: # pylint: disable=broad-except
self.log.exception('Error setting %s.%s to %s', self.log.error('Error setting %s.%s to %s: %s',
vm.name, 'default_dispvm', value) vm.name, 'default_dispvm', value, err)