diff --git a/ironic_lib/disk_utils.py b/ironic_lib/disk_utils.py index ab1b793d..544a2d44 100644 --- a/ironic_lib/disk_utils.py +++ b/ironic_lib/disk_utils.py @@ -211,8 +211,9 @@ def is_block_device(dev): s = os.stat(dev) except OSError as e: LOG.debug("Unable to stat device %(dev)s. Attempt %(attempt)d " - "out of %(total)d. Error: %(err)s", {"dev": dev, - "attempt": attempt + 1, "total": attempts, "err": e}) + "out of %(total)d. Error: %(err)s", + {"dev": dev, "attempt": attempt + 1, + "total": attempts, "err": e}) time.sleep(1) else: return stat.S_ISBLK(s.st_mode) @@ -461,7 +462,7 @@ def work_on_disk(dev, root_mb, swap_mb, ephemeral_mb, ephemeral_format, part_device = part_dict.get(part) LOG.debug("Checking for %(part)s device (%(dev)s) on node " "%(node)s.", {'part': part, 'dev': part_device, - 'node': node_uuid}) + 'node': node_uuid}) if part_device and not is_block_device(part_device): raise exception.InstanceDeployFailure( _("'%(partition)s' device '%(part_device)s' not found") % diff --git a/tests/ironic_lib/test_disk_partitioner.py b/tests/ironic_lib/test_disk_partitioner.py index 3d5ba64a..00e7e55a 100644 --- a/tests/ironic_lib/test_disk_partitioner.py +++ b/tests/ironic_lib/test_disk_partitioner.py @@ -71,8 +71,8 @@ class DiskPartitionerTestCase(test_base.BaseTestCase): 'mkpart', 'fake-type', 'fake-fs-type', '1', '2', 'mkpart', 'fake-type', 'fake-fs-type', '2', '3', 'set', '2', 'boot', 'on') - mock_utils_exc.assert_called_once_with('fuser', '/dev/fake', - run_as_root=True, check_exit_code=[0, 1]) + mock_utils_exc.assert_called_once_with( + 'fuser', '/dev/fake', run_as_root=True, check_exit_code=[0, 1]) @mock.patch.object(disk_partitioner.DiskPartitioner, '_exec', autospec=True) @@ -100,8 +100,8 @@ class DiskPartitionerTestCase(test_base.BaseTestCase): 'mkpart', 'fake-type', 'fake-fs-type', '1', '2', 'mkpart', 'fake-type', 'fake-fs-type', '2', '3', 'set', '2', 'boot', 'on') - mock_utils_exc.assert_called_with('fuser', '/dev/fake', - run_as_root=True, check_exit_code=[0, 1]) + mock_utils_exc.assert_called_with( + 'fuser', '/dev/fake', run_as_root=True, check_exit_code=[0, 1]) self.assertEqual(2, mock_utils_exc.call_count) @mock.patch.object(disk_partitioner.DiskPartitioner, '_exec', @@ -129,8 +129,8 @@ class DiskPartitionerTestCase(test_base.BaseTestCase): 'mkpart', 'fake-type', 'fake-fs-type', '1', '2', 'mkpart', 'fake-type', 'fake-fs-type', '2', '3', 'set', '2', 'boot', 'on') - mock_utils_exc.assert_called_with('fuser', '/dev/fake', - run_as_root=True, check_exit_code=[0, 1]) + mock_utils_exc.assert_called_with( + 'fuser', '/dev/fake', run_as_root=True, check_exit_code=[0, 1]) self.assertEqual(20, mock_utils_exc.call_count) @mock.patch.object(disk_partitioner.DiskPartitioner, '_exec', @@ -159,6 +159,6 @@ class DiskPartitionerTestCase(test_base.BaseTestCase): 'mkpart', 'fake-type', 'fake-fs-type', '1', '2', 'mkpart', 'fake-type', 'fake-fs-type', '2', '3', 'set', '2', 'boot', 'on') - mock_utils_exc.assert_called_with('fuser', '/dev/fake', - run_as_root=True, check_exit_code=[0, 1]) + mock_utils_exc.assert_called_with( + 'fuser', '/dev/fake', run_as_root=True, check_exit_code=[0, 1]) self.assertEqual(20, mock_utils_exc.call_count) diff --git a/tests/ironic_lib/test_disk_utils.py b/tests/ironic_lib/test_disk_utils.py index a1779638..7b1a4fff 100644 --- a/tests/ironic_lib/test_disk_utils.py +++ b/tests/ironic_lib/test_disk_utils.py @@ -208,8 +208,8 @@ class MakePartitionsTestCase(test_base.BaseTestCase): def _test_make_partitions(self, mock_exc, boot_option): mock_exc.return_value = (None, None) disk_utils.make_partitions(self.dev, self.root_mb, self.swap_mb, - self.ephemeral_mb, self.configdrive_mb, - boot_option=boot_option) + self.ephemeral_mb, self.configdrive_mb, + boot_option=boot_option) expected_mkpart = ['mkpart', 'primary', 'linux-swap', '1', '513', 'mkpart', 'primary', '', '513', '1537'] @@ -239,7 +239,7 @@ class MakePartitionsTestCase(test_base.BaseTestCase): cmd = self._get_parted_cmd(self.dev) + expected_mkpart mock_exc.return_value = (None, None) disk_utils.make_partitions(self.dev, self.root_mb, self.swap_mb, - self.ephemeral_mb, self.configdrive_mb) + self.ephemeral_mb, self.configdrive_mb) parted_call = mock.call(*cmd, run_as_root=True, check_exit_code=[0]) mock_exc.assert_has_calls([parted_call]) @@ -255,8 +255,9 @@ class MakePartitionsTestCase(test_base.BaseTestCase): 'root': 'fake-dev3'} cmd = self._get_parted_cmd(self.dev) + expected_mkpart mock_exc.return_value = (None, None) - result = disk_utils.make_partitions(self.dev, self.root_mb, - self.swap_mb, self.ephemeral_mb, self.configdrive_mb) + result = disk_utils.make_partitions( + self.dev, self.root_mb, self.swap_mb, self.ephemeral_mb, + self.configdrive_mb) parted_call = mock.call(*cmd, run_as_root=True, check_exit_code=[0]) mock_exc.assert_has_calls([parted_call]) @@ -273,8 +274,9 @@ class MakePartitionsTestCase(test_base.BaseTestCase): 'root': self.dev + '-part3'} cmd = self._get_parted_cmd(self.dev) + expected_mkpart mock_exc.return_value = (None, None) - result = disk_utils.make_partitions(self.dev, self.root_mb, - self.swap_mb, self.ephemeral_mb, self.configdrive_mb) + result = disk_utils.make_partitions( + self.dev, self.root_mb, self.swap_mb, self.ephemeral_mb, + self.configdrive_mb) parted_call = mock.call(*cmd, run_as_root=True, check_exit_code=[0]) mock_exc.assert_has_calls([parted_call]) @@ -294,9 +296,9 @@ class MakePartitionsTestCase(test_base.BaseTestCase): 'root': self.dev + '-part4'} cmd = self._get_parted_cmd_uefi(self.dev) + expected_mkpart mock_exc.return_value = (None, None) - result = disk_utils.make_partitions(self.dev, self.root_mb, - self.swap_mb, self.ephemeral_mb, self.configdrive_mb, - boot_option='local', boot_mode='uefi') + result = disk_utils.make_partitions( + self.dev, self.root_mb, self.swap_mb, self.ephemeral_mb, + self.configdrive_mb, boot_option='local', boot_mode='uefi') parted_call = mock.call(*cmd, run_as_root=True, check_exit_code=[0]) mock_exc.assert_has_calls([parted_call]) diff --git a/tox.ini b/tox.ini index 94524a4c..edde13c8 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ commands = [flake8] show-source = True -ignore = E128,E129 +ignore = E129 exclude = .venv,.tox,dist,doc,*.egg,.update-venv [testenv:pep8]