From 32c6083e1c74f4a5b331e6ff6dff7d2582c3f7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 21 Dec 2017 18:19:10 +0100 Subject: [PATCH] Make pylint happy Fix thing detected by updated pylint in Travis-CI --- qubes/api/__init__.py | 2 +- qubes/backup.py | 3 ++- qubes/core2migration.py | 1 + qubes/storage/file.py | 3 ++- qubes/storage/kernels.py | 1 + qubes/storage/lvm.py | 3 ++- qubes/vm/mix/net.py | 2 +- qubes/vm/qubesvm.py | 4 ++-- qubespolicy/utils.py | 3 +-- 9 files changed, 13 insertions(+), 9 deletions(-) diff --git a/qubes/api/__init__.py b/qubes/api/__init__.py index e93d0a1b..e5097fda 100644 --- a/qubes/api/__init__.py +++ b/qubes/api/__init__.py @@ -244,7 +244,7 @@ class QubesDaemonProtocol(asyncio.Protocol): except ValueError: self.app.log.warning('framing error') self.transport.abort() - return + return None finally: self.untrusted_buffer.close() diff --git a/qubes/backup.py b/qubes/backup.py index 3e0e91a1..03a2cfcc 100644 --- a/qubes/backup.py +++ b/qubes/backup.py @@ -851,11 +851,12 @@ def handle_streams(stream_in, stream_out, size_limit=None, buf = yield from stream_in.read(to_copy) if not buf: # done - return None + break if callable(progress_callback): progress_callback(len(buf)) stream_out.write(buf) bytes_copied += len(buf) + return None # vim:sw=4:et: diff --git a/qubes/core2migration.py b/qubes/core2migration.py index 80fb59b7..942c709b 100644 --- a/qubes/core2migration.py +++ b/qubes/core2migration.py @@ -276,6 +276,7 @@ class Core2Qubes(qubes.Qubes): if not lock: self._release_lock() + return True def save(self, lock=False): raise NotImplementedError("Saving old qubes.xml not supported") diff --git a/qubes/storage/file.py b/qubes/storage/file.py index cb5b0b35..10c1b304 100644 --- a/qubes/storage/file.py +++ b/qubes/storage/file.py @@ -337,6 +337,7 @@ class FileVolume(qubes.storage.Volume): return 'block-origin' elif self.snap_on_start: return 'block-snapshot' + return None def block_device(self): ''' Return :py:class:`qubes.storage.BlockDevice` for serialization in @@ -379,7 +380,7 @@ class FileVolume(qubes.storage.Volume): def create_sparse_file(path, size): ''' Create an empty sparse file ''' if os.path.exists(path): - raise IOError("Volume %s already exists", path) + raise IOError("Volume %s already exists" % path) parent_dir = os.path.dirname(path) if not os.path.exists(parent_dir): os.makedirs(parent_dir) diff --git a/qubes/storage/kernels.py b/qubes/storage/kernels.py index 1e765b68..a1a6b18d 100644 --- a/qubes/storage/kernels.py +++ b/qubes/storage/kernels.py @@ -123,6 +123,7 @@ class LinuxModules(Volume): def block_device(self): if self.vid: return super().block_device() + return None class LinuxKernel(Pool): diff --git a/qubes/storage/lvm.py b/qubes/storage/lvm.py index 8b76dd71..e814bb06 100644 --- a/qubes/storage/lvm.py +++ b/qubes/storage/lvm.py @@ -238,7 +238,7 @@ class ThinVolume(qubes.storage.Volume): ''' Resets a volatile volume ''' assert not self.snap_on_start and not self.save_on_stop, \ "Not a volatile volume" - self.log.debug('Resetting volatile ' + self.vid) + self.log.debug('Resetting volatile %s', self.vid) try: cmd = ['remove', self.vid] qubes_lvm(cmd, self.log) @@ -493,6 +493,7 @@ class ThinVolume(qubes.storage.Volume): except KeyError: raise qubes.storage.StoragePoolException( 'volume {} missing'.format(vid)) + return True def block_device(self): diff --git a/qubes/vm/mix/net.py b/qubes/vm/mix/net.py index 344c460f..351618ae 100644 --- a/qubes/vm/mix/net.py +++ b/qubes/vm/mix/net.py @@ -66,7 +66,7 @@ def _default_ip6(self): def _setter_netvm(self, prop, value): # pylint: disable=unused-argument if value is None: - return + return None if not value.provides_network: raise qubes.exc.QubesValueError( 'The {!s} qube does not provide network'.format(value)) diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index 35dfee2c..6450b90d 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -835,7 +835,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): # Intentionally not used is_running(): eliminate also "Paused", # "Crashed", "Halting" if self.get_power_state() != 'Halted': - return + return self with (yield from self._domain_stopped_lock): # Don't accept any new stopped event's till a new VM has been @@ -1229,7 +1229,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): # add an extra MB because Nova rounds up to MBs if not qmemman_present: - return + return None if mem_required is None: if self.virt_mode == 'hvm': diff --git a/qubespolicy/utils.py b/qubespolicy/utils.py index 368a369b..4528b6b6 100644 --- a/qubespolicy/utils.py +++ b/qubespolicy/utils.py @@ -46,8 +46,7 @@ def _sanitize_name(input_string, extra_allowed_characters, assert_sanitized): if assert_sanitized: assert input_string == result, \ 'Input string was expected to be sanitized, but was not.' - else: - return result + return result def sanitize_domain_name(input_string, assert_sanitized=False):