Make pylint happy
no-else-raise warning
This commit is contained in:
parent
05f0d4ca0f
commit
d7430d42ce
@ -1003,7 +1003,6 @@ class BackupRestore(object):
|
||||
if f_one.read() != f_two.read():
|
||||
raise QubesException(
|
||||
'Invalid hmac on {}'.format(filename))
|
||||
else:
|
||||
return True
|
||||
|
||||
with open(os.path.join(self.tmpdir, filename), 'rb') as f_input:
|
||||
@ -1016,7 +1015,6 @@ class BackupRestore(object):
|
||||
if hmac_stderr:
|
||||
raise QubesException(
|
||||
"ERROR: verify file {0}: {1}".format(filename, hmac_stderr))
|
||||
else:
|
||||
self.log.debug("Loading hmac for file %s", filename)
|
||||
try:
|
||||
with open(os.path.join(self.tmpdir, hmacfile), 'r',
|
||||
@ -1242,7 +1240,7 @@ class BackupRestore(object):
|
||||
"""
|
||||
if self.header_data.version == 1:
|
||||
raise NotImplementedError('Backup format version 1 not supported')
|
||||
elif self.header_data.version in [2, 3]:
|
||||
if self.header_data.version in [2, 3]:
|
||||
self._retrieve_backup_header_files(
|
||||
['qubes.xml.000', 'qubes.xml.000.hmac'])
|
||||
self._verify_hmac("qubes.xml.000", "qubes.xml.000.hmac")
|
||||
@ -1407,7 +1405,6 @@ class BackupRestore(object):
|
||||
raise QubesException(
|
||||
'retrieved backup size exceed expected size, if you '
|
||||
'believe this is ok, use --ignore-size-limit option')
|
||||
else:
|
||||
raise QubesException(
|
||||
"unable to read the qubes backup file {} ({}): {}"
|
||||
.format(self.backup_location,
|
||||
@ -1837,7 +1834,6 @@ class BackupRestore(object):
|
||||
except QubesException as err:
|
||||
if self.options.verify_only:
|
||||
raise
|
||||
else:
|
||||
self.log.error('Error extracting data: %s', str(err))
|
||||
finally:
|
||||
if self.log.getEffectiveLevel() > logging.DEBUG:
|
||||
|
@ -100,7 +100,6 @@ class PropertyHolder(object):
|
||||
exc_class = qubesadmin.exc.QubesException
|
||||
# TODO: handle traceback if given
|
||||
raise exc_class(format_string, *args)
|
||||
else:
|
||||
raise qubesadmin.exc.QubesDaemonCommunicationError(
|
||||
'Invalid response format')
|
||||
|
||||
|
@ -89,7 +89,7 @@ class DstHost(RuleOption):
|
||||
# TODO: in python >= 3.3 ipaddress module could be used
|
||||
if value.count('/') > 1:
|
||||
raise ValueError('Too many /: ' + value)
|
||||
elif not value.count('/'):
|
||||
if not value.count('/'):
|
||||
# add prefix length to bare IP addresses
|
||||
try:
|
||||
socket.inet_pton(socket.AF_INET6, value)
|
||||
|
@ -142,7 +142,7 @@ def handle_broken(app, args, restore_info):
|
||||
raise qubesadmin.exc.QubesException(
|
||||
"Install them before proceeding with the restore."
|
||||
"Or pass: --skip-broken or --ignore-missing.")
|
||||
elif args.skip_broken:
|
||||
if args.skip_broken:
|
||||
app.log.warning("Skipping broken entries: VMs that depend on "
|
||||
"missing TemplateVMs will NOT be restored.")
|
||||
elif args.ignore_missing:
|
||||
@ -160,7 +160,7 @@ def handle_broken(app, args, restore_info):
|
||||
raise qubesadmin.exc.QubesException(
|
||||
"Install them before proceeding with the restore."
|
||||
"Or pass: --skip-broken or --ignore-missing.")
|
||||
elif args.skip_broken:
|
||||
if args.skip_broken:
|
||||
app.log.warning("Skipping broken entries: VMs that depend on "
|
||||
"missing NetVMs will NOT be restored.")
|
||||
elif args.ignore_missing:
|
||||
@ -180,7 +180,6 @@ def handle_broken(app, args, restore_info):
|
||||
"Skip restoring the dom0 home directory "
|
||||
"(--skip-dom0-home), or pass "
|
||||
"--ignore-username-mismatch to continue anyway.")
|
||||
else:
|
||||
app.log.warning("Continuing as directed.")
|
||||
app.log.warning("NOTE: The archived dom0 home directory "
|
||||
"will be restored to a new directory "
|
||||
|
@ -91,7 +91,7 @@ def get_entry_point_one(group, name):
|
||||
epoints = tuple(pkg_resources.iter_entry_points(group, name))
|
||||
if not epoints:
|
||||
raise KeyError(name)
|
||||
elif len(epoints) > 1:
|
||||
if len(epoints) > 1:
|
||||
raise TypeError(
|
||||
'more than 1 implementation of {!r} found: {}'.format(name,
|
||||
', '.join('{}.{}'.format(ep.module_name, '.'.join(ep.attrs))
|
||||
|
Loading…
Reference in New Issue
Block a user