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