Remove default parameter from execute
The param check_exit_code from the processutils extension execute has default already at [0] See: https://opendev.org/openstack/oslo.concurrency/src/branch/master/oslo_concurrency/processutils.py#L214 Change-Id: Ia0f42bf3de9c074a1212859352b5c5e1abe7eed8
This commit is contained in:
parent
0b955a2bf7
commit
e7a35e41f1
|
@ -70,8 +70,8 @@ class DiskPartitioner(object):
|
|||
# exceptions. It also logs any failure so we don't
|
||||
# need to log it again here.
|
||||
utils.execute('parted', '-a', self._alignment, '-s', self._device,
|
||||
'--', 'unit', 'MiB', *args, check_exit_code=[0],
|
||||
use_standard_locale=True, run_as_root=True)
|
||||
'--', 'unit', 'MiB', *args, use_standard_locale=True,
|
||||
run_as_root=True)
|
||||
|
||||
def add_partition(self, size, part_type='primary', fs_type='',
|
||||
boot_flag=None, extra_flags=None):
|
||||
|
|
|
@ -172,11 +172,8 @@ def get_disk_identifier(dev):
|
|||
"""
|
||||
disk_identifier = utils.execute('hexdump', '-s', '440', '-n', '4',
|
||||
'-e', '''\"0x%08x\"''',
|
||||
dev,
|
||||
run_as_root=True,
|
||||
check_exit_code=[0],
|
||||
attempts=5,
|
||||
delay_on_retry=True)
|
||||
dev, run_as_root=True,
|
||||
attempts=5, delay_on_retry=True)
|
||||
return disk_identifier[0]
|
||||
|
||||
|
||||
|
@ -538,7 +535,7 @@ def get_image_mb(image_path, virtual_size=True):
|
|||
def get_dev_block_size(dev):
|
||||
"""Get the device size in 512 byte sectors."""
|
||||
block_sz, cmderr = utils.execute('blockdev', '--getsz', dev,
|
||||
run_as_root=True, check_exit_code=[0])
|
||||
run_as_root=True)
|
||||
return int(block_sz)
|
||||
|
||||
|
||||
|
@ -1142,8 +1139,7 @@ def create_config_drive_partition(node_uuid, device, configdrive):
|
|||
LOG.debug('Waiting for the config drive partition %(part)s '
|
||||
'on node %(node)s to be ready for writing.',
|
||||
{'part': config_drive_part, 'node': node_uuid})
|
||||
utils.execute('test', '-e', config_drive_part,
|
||||
check_exit_code=[0], attempts=15,
|
||||
utils.execute('test', '-e', config_drive_part, attempts=15,
|
||||
delay_on_retry=True)
|
||||
|
||||
dd(confdrive_file, config_drive_part)
|
||||
|
|
|
@ -571,7 +571,7 @@ class MakePartitionsTestCase(base.IronicLibTestCase):
|
|||
parted_cmd = (self._get_parted_cmd(self.dev, disk_label)
|
||||
+ expected_mkpart)
|
||||
parted_call = mock.call(*parted_cmd, use_standard_locale=True,
|
||||
run_as_root=True, check_exit_code=[0])
|
||||
run_as_root=True)
|
||||
fuser_cmd = ['fuser', 'fake-dev']
|
||||
fuser_call = mock.call(*fuser_cmd, run_as_root=True,
|
||||
check_exit_code=[0, 1])
|
||||
|
@ -623,7 +623,7 @@ class MakePartitionsTestCase(base.IronicLibTestCase):
|
|||
self.node_uuid)
|
||||
|
||||
parted_call = mock.call(*cmd, use_standard_locale=True,
|
||||
run_as_root=True, check_exit_code=[0])
|
||||
run_as_root=True)
|
||||
mock_exc.assert_has_calls([parted_call])
|
||||
|
||||
def test_make_partitions_with_iscsi_device(self, mock_exc):
|
||||
|
@ -647,7 +647,7 @@ class MakePartitionsTestCase(base.IronicLibTestCase):
|
|||
self.configdrive_mb, self.node_uuid)
|
||||
|
||||
parted_call = mock.call(*cmd, use_standard_locale=True,
|
||||
run_as_root=True, check_exit_code=[0])
|
||||
run_as_root=True)
|
||||
mock_exc.assert_has_calls([parted_call])
|
||||
self.assertEqual(expected_result, result)
|
||||
|
||||
|
@ -670,7 +670,7 @@ class MakePartitionsTestCase(base.IronicLibTestCase):
|
|||
self.configdrive_mb, self.node_uuid)
|
||||
|
||||
parted_call = mock.call(*cmd, use_standard_locale=True,
|
||||
run_as_root=True, check_exit_code=[0])
|
||||
run_as_root=True)
|
||||
mock_exc.assert_has_calls([parted_call])
|
||||
self.assertEqual(expected_result, result)
|
||||
|
||||
|
@ -690,7 +690,7 @@ class MakePartitionsTestCase(base.IronicLibTestCase):
|
|||
self.configdrive_mb, self.node_uuid)
|
||||
|
||||
parted_call = mock.call(*cmd, use_standard_locale=True,
|
||||
run_as_root=True, check_exit_code=[0])
|
||||
run_as_root=True)
|
||||
mock_exc.assert_has_calls([parted_call])
|
||||
self.assertEqual(expected_result, result)
|
||||
|
||||
|
@ -719,7 +719,6 @@ class DestroyMetaDataTestCase(base.IronicLibTestCase):
|
|||
run_as_root=True,
|
||||
use_standard_locale=True),
|
||||
mock.call('blockdev', '--getsz', 'fake-dev',
|
||||
check_exit_code=[0],
|
||||
run_as_root=True),
|
||||
mock.call('dd', 'bs=512', 'if=/dev/zero',
|
||||
'of=fake-dev', 'count=33',
|
||||
|
@ -755,7 +754,6 @@ class DestroyMetaDataTestCase(base.IronicLibTestCase):
|
|||
run_as_root=True,
|
||||
use_standard_locale=True),
|
||||
mock.call('blockdev', '--getsz', 'fake-dev',
|
||||
check_exit_code=[0],
|
||||
run_as_root=True),
|
||||
mock.call('dd', 'bs=512', 'if=/dev/zero',
|
||||
'of=fake-dev', 'count=33',
|
||||
|
@ -804,7 +802,6 @@ class DestroyMetaDataTestCase(base.IronicLibTestCase):
|
|||
run_as_root=True,
|
||||
use_standard_locale=True),
|
||||
mock.call('blockdev', '--getsz', 'fake-dev',
|
||||
check_exit_code=[0],
|
||||
run_as_root=True),
|
||||
mock.call('dd', 'bs=512', 'if=/dev/zero',
|
||||
'of=fake-dev', 'count=2',
|
||||
|
@ -828,7 +825,6 @@ class DestroyMetaDataTestCase(base.IronicLibTestCase):
|
|||
run_as_root=True,
|
||||
use_standard_locale=True),
|
||||
mock.call('blockdev', '--getsz', 'fake-dev',
|
||||
check_exit_code=[0],
|
||||
run_as_root=True),
|
||||
mock.call('dd', 'bs=512', 'if=/dev/zero',
|
||||
'of=fake-dev', 'count=33',
|
||||
|
@ -863,7 +859,7 @@ class GetDeviceBlockSizeTestCase(base.IronicLibTestCase):
|
|||
def test_get_dev_block_size(self, mock_exec):
|
||||
mock_exec.return_value = ("64", "")
|
||||
expected_call = [mock.call('blockdev', '--getsz', self.dev,
|
||||
run_as_root=True, check_exit_code=[0])]
|
||||
run_as_root=True)]
|
||||
disk_utils.get_dev_block_size(self.dev)
|
||||
mock_exec.assert_has_calls(expected_call)
|
||||
|
||||
|
@ -1540,7 +1536,7 @@ class WholeDiskConfigDriveTestCases(base.IronicLibTestCase):
|
|||
|
||||
mock.call('udevadm', 'settle'),
|
||||
mock.call('test', '-e', expected_part, attempts=15,
|
||||
check_exit_code=[0], delay_on_retry=True)
|
||||
delay_on_retry=True)
|
||||
])
|
||||
|
||||
self.assertEqual(2, mock_list_partitions.call_count)
|
||||
|
@ -1644,7 +1640,7 @@ class WholeDiskConfigDriveTestCases(base.IronicLibTestCase):
|
|||
mock.call('sgdisk', '-v', self.dev, run_as_root=True),
|
||||
mock.call('udevadm', 'settle'),
|
||||
mock.call('test', '-e', expected_part, attempts=15,
|
||||
check_exit_code=[0], delay_on_retry=True)
|
||||
delay_on_retry=True)
|
||||
])
|
||||
self.assertEqual(2, mock_list_partitions.call_count)
|
||||
mock_table_type.assert_called_with(self.dev)
|
||||
|
|
|
@ -189,7 +189,7 @@ def dd(src, dst, *args):
|
|||
"""
|
||||
LOG.debug("Starting dd process.")
|
||||
execute('dd', 'if=%s' % src, 'of=%s' % dst, *args,
|
||||
use_standard_locale=True, run_as_root=True, check_exit_code=[0])
|
||||
use_standard_locale=True, run_as_root=True)
|
||||
|
||||
|
||||
def is_http_url(url):
|
||||
|
|
Loading…
Reference in New Issue