Increase version of hacking and pycodestyle
Fix H904 "Delay string interpolations at logging calls" errors Change-Id: I331808d0132094faf739998a6984440787d3ebf8
This commit is contained in:
parent
9b42b08edd
commit
efbbc86f53
@ -190,5 +190,8 @@ class ExampleBusinessLogicHardwareManager(hardware.HardwareManager):
|
|||||||
# Make sure to provide default values for optional arguments.
|
# Make sure to provide default values for optional arguments.
|
||||||
def companyx_apply_something(self, node, ports, required_value,
|
def companyx_apply_something(self, node, ports, required_value,
|
||||||
optional_value=None):
|
optional_value=None):
|
||||||
LOG.info('apply_something called with required_value={} and '
|
LOG.info('apply_something called with '
|
||||||
'optional_value={}'.format(required_value, optional_value))
|
'required_value=%(required_value)s and '
|
||||||
|
'optional_value=%(optional_value)s',
|
||||||
|
{'required_value': required_value,
|
||||||
|
'optional_value': optional_value})
|
||||||
|
@ -125,17 +125,16 @@ class IronicPythonAgentHeartbeater(threading.Thread):
|
|||||||
self.heartbeat_forced = False
|
self.heartbeat_forced = False
|
||||||
self.previous_heartbeat = _time()
|
self.previous_heartbeat = _time()
|
||||||
except errors.HeartbeatConflictError:
|
except errors.HeartbeatConflictError:
|
||||||
LOG.warning('conflict error sending heartbeat to {}'.format(
|
LOG.warning('conflict error sending heartbeat to %s',
|
||||||
self.agent.api_url))
|
self.agent.api_url)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception('error sending heartbeat to {}'.format(
|
LOG.exception('error sending heartbeat to %s', self.agent.api_url)
|
||||||
self.agent.api_url))
|
|
||||||
finally:
|
finally:
|
||||||
interval_multiplier = random.uniform(self.min_jitter_multiplier,
|
interval_multiplier = random.uniform(self.min_jitter_multiplier,
|
||||||
self.max_jitter_multiplier)
|
self.max_jitter_multiplier)
|
||||||
self.interval = self.agent.heartbeat_timeout * interval_multiplier
|
self.interval = self.agent.heartbeat_timeout * interval_multiplier
|
||||||
log_msg = 'sleeping before next heartbeat, interval: {0}'
|
LOG.info('sleeping before next heartbeat, interval: %s',
|
||||||
LOG.info(log_msg.format(self.interval))
|
self.interval)
|
||||||
|
|
||||||
def force_heartbeat(self):
|
def force_heartbeat(self):
|
||||||
self.heartbeat_forced = True
|
self.heartbeat_forced = True
|
||||||
|
@ -489,8 +489,9 @@ def _prepare_boot_partitions_for_softraid(device, holders, efi_part,
|
|||||||
|
|
||||||
# RAID the ESPs, metadata=1.0 is mandatory to be able to boot
|
# RAID the ESPs, metadata=1.0 is mandatory to be able to boot
|
||||||
md_device = '/dev/md/esp'
|
md_device = '/dev/md/esp'
|
||||||
LOG.debug("Creating md device {} for the ESPs on {}".format(
|
LOG.debug("Creating md device %(md_device)s for the ESPs "
|
||||||
md_device, efi_partitions))
|
"on %(efi_partitions)s",
|
||||||
|
{'md_device': md_device, 'efi_partitions': efi_partitions})
|
||||||
utils.execute('mdadm', '--create', md_device, '--force',
|
utils.execute('mdadm', '--create', md_device, '--force',
|
||||||
'--run', '--metadata=1.0', '--level', '1',
|
'--run', '--metadata=1.0', '--level', '1',
|
||||||
'--raid-devices', len(efi_partitions),
|
'--raid-devices', len(efi_partitions),
|
||||||
|
@ -202,7 +202,7 @@ def _write_whole_disk_image(image, image_info, device):
|
|||||||
command = ['qemu-img', 'convert',
|
command = ['qemu-img', 'convert',
|
||||||
'-t', 'directsync', '-O', 'host_device', '-W',
|
'-t', 'directsync', '-O', 'host_device', '-W',
|
||||||
image, device]
|
image, device]
|
||||||
LOG.info('Writing image with command: {}'.format(' '.join(command)))
|
LOG.info('Writing image with command: %s', ' '.join(command))
|
||||||
try:
|
try:
|
||||||
disk_utils.convert_image(image, device, out_format='host_device',
|
disk_utils.convert_image(image, device, out_format='host_device',
|
||||||
cache='directsync', out_of_order=True)
|
cache='directsync', out_of_order=True)
|
||||||
@ -232,8 +232,9 @@ def _write_image(image_info, device, configdrive=None):
|
|||||||
else:
|
else:
|
||||||
_write_whole_disk_image(image, image_info, device)
|
_write_whole_disk_image(image, image_info, device)
|
||||||
totaltime = time.time() - starttime
|
totaltime = time.time() - starttime
|
||||||
LOG.info('Image {} written to device {} in {} seconds'.format(
|
LOG.info('Image %(image)s written to device %(device)s in %(totaltime)s '
|
||||||
image, device, totaltime))
|
'seconds', {'image': image, 'device': device,
|
||||||
|
'totaltime': totaltime})
|
||||||
try:
|
try:
|
||||||
disk_utils.fix_gpt_partition(device, node_uuid=None)
|
disk_utils.fix_gpt_partition(device, node_uuid=None)
|
||||||
except exception.InstanceDeployFailure:
|
except exception.InstanceDeployFailure:
|
||||||
@ -329,7 +330,7 @@ class ImageDownload(object):
|
|||||||
details = []
|
details = []
|
||||||
for url in image_info['urls']:
|
for url in image_info['urls']:
|
||||||
try:
|
try:
|
||||||
LOG.info("Attempting to download image from {}".format(url))
|
LOG.info("Attempting to download image from %s", url)
|
||||||
self._request = _download_with_proxy(image_info, url,
|
self._request = _download_with_proxy(image_info, url,
|
||||||
image_info['id'])
|
image_info['id'])
|
||||||
except errors.ImageDownloadError as e:
|
except errors.ImageDownloadError as e:
|
||||||
@ -386,12 +387,16 @@ class ImageDownload(object):
|
|||||||
not match the checksum as reported by glance in image_info.
|
not match the checksum as reported by glance in image_info.
|
||||||
"""
|
"""
|
||||||
checksum = self._hash_algo.hexdigest()
|
checksum = self._hash_algo.hexdigest()
|
||||||
LOG.debug('Verifying image at {} against {} checksum '
|
LOG.debug('Verifying image at %(image_location)s against '
|
||||||
'{}'.format(image_location, self._hash_algo.name, checksum))
|
'%(algo_name)s checksum %(checksum)s',
|
||||||
|
{'image_location': image_location,
|
||||||
|
'algo_name': self._hash_algo.name,
|
||||||
|
'checksum': checksum})
|
||||||
if checksum != self._expected_hash_value:
|
if checksum != self._expected_hash_value:
|
||||||
LOG.error(errors.ImageChecksumError.details_str.format(
|
error_msg = errors.ImageChecksumError.details_str.format(
|
||||||
image_location, self._image_info['id'],
|
image_location, self._image_info['id'],
|
||||||
self._expected_hash_value, checksum))
|
self._expected_hash_value, checksum)
|
||||||
|
LOG.error(error_msg)
|
||||||
raise errors.ImageChecksumError(image_location,
|
raise errors.ImageChecksumError(image_location,
|
||||||
self._image_info['id'],
|
self._image_info['id'],
|
||||||
self._expected_hash_value,
|
self._expected_hash_value,
|
||||||
@ -434,8 +439,10 @@ def _download_image(image_info):
|
|||||||
break
|
break
|
||||||
|
|
||||||
totaltime = time.time() - starttime
|
totaltime = time.time() - starttime
|
||||||
LOG.info("Image downloaded from {} in {} seconds".format(image_location,
|
LOG.info("Image downloaded from %(image_location)s "
|
||||||
totaltime))
|
"in %(totaltime)s seconds",
|
||||||
|
{'image_location': image_location,
|
||||||
|
'totaltime': totaltime})
|
||||||
image_download.verify_image(image_location)
|
image_download.verify_image(image_location)
|
||||||
|
|
||||||
|
|
||||||
@ -597,8 +604,8 @@ class StandbyExtension(base.BaseAgentExtension):
|
|||||||
break
|
break
|
||||||
|
|
||||||
totaltime = time.time() - starttime
|
totaltime = time.time() - starttime
|
||||||
LOG.info("Image streamed onto device {} in {} "
|
LOG.info("Image streamed onto device %(device)s in %(totaltime)s "
|
||||||
"seconds".format(device, totaltime))
|
"seconds", {'device': device, 'totaltime': totaltime})
|
||||||
# Verify if the checksum of the streamed image is correct
|
# Verify if the checksum of the streamed image is correct
|
||||||
image_download.verify_image(device)
|
image_download.verify_image(device)
|
||||||
# Fix any gpt partition
|
# Fix any gpt partition
|
||||||
@ -609,7 +616,8 @@ class StandbyExtension(base.BaseAgentExtension):
|
|||||||
pass
|
pass
|
||||||
# Fix the root partition UUID
|
# Fix the root partition UUID
|
||||||
root_uuid = disk_utils.block_uuid(device)
|
root_uuid = disk_utils.block_uuid(device)
|
||||||
LOG.info("{} UUID is now {}".format(device, root_uuid))
|
LOG.info("%(device)s UUID is now %(root_uuid)s",
|
||||||
|
{'device': device, 'root_uuid': root_uuid})
|
||||||
self.partition_uuids['root uuid'] = root_uuid
|
self.partition_uuids['root uuid'] = root_uuid
|
||||||
|
|
||||||
def _fix_up_partition_uuids(self, image_info, device):
|
def _fix_up_partition_uuids(self, image_info, device):
|
||||||
|
@ -445,13 +445,13 @@ def list_all_block_devices(block_type='disk',
|
|||||||
# lvm, part, rom, loop
|
# lvm, part, rom, loop
|
||||||
if devtype != block_type:
|
if devtype != block_type:
|
||||||
if devtype is None or ignore_raid:
|
if devtype is None or ignore_raid:
|
||||||
LOG.debug("Skipping: {!r}".format(line))
|
LOG.debug("Skipping: %s", line)
|
||||||
continue
|
continue
|
||||||
elif ('raid' in devtype
|
elif ('raid' in devtype
|
||||||
and block_type in ['raid', 'disk']):
|
and block_type in ['raid', 'disk']):
|
||||||
LOG.debug(
|
LOG.debug(
|
||||||
"TYPE detected to contain 'raid', signifying a "
|
"TYPE detected to contain 'raid', signifying a "
|
||||||
"RAID volume. Found: {!r}".format(line))
|
"RAID volume. Found: %s", line)
|
||||||
elif (devtype == 'md'
|
elif (devtype == 'md'
|
||||||
and (block_type == 'part'
|
and (block_type == 'part'
|
||||||
or block_type == 'md')):
|
or block_type == 'md')):
|
||||||
@ -461,11 +461,11 @@ def list_all_block_devices(block_type='disk',
|
|||||||
# more detail.
|
# more detail.
|
||||||
LOG.debug(
|
LOG.debug(
|
||||||
"TYPE detected to contain 'md', signifying a "
|
"TYPE detected to contain 'md', signifying a "
|
||||||
"RAID partition. Found: {!r}".format(line))
|
"RAID partition. Found: %s", line)
|
||||||
else:
|
else:
|
||||||
LOG.debug(
|
LOG.debug(
|
||||||
"TYPE did not match. Wanted: {!r} but found: {!r}".format(
|
"TYPE did not match. Wanted: %(block_type)s but found: "
|
||||||
block_type, line))
|
"%(line)s", {'block_type': block_type, 'line': line})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Ensure all required columns are at least present, even if blank
|
# Ensure all required columns are at least present, even if blank
|
||||||
|
@ -64,9 +64,10 @@ def _disable_embedded_lldp_agent_in_cna_card():
|
|||||||
failed_dirs.append(inner_dir)
|
failed_dirs.append(inner_dir)
|
||||||
continue
|
continue
|
||||||
if failed_dirs:
|
if failed_dirs:
|
||||||
LOG.warning('Failed to disable the embedded LLDP on Intel CNA network '
|
warning_msg = ('Failed to disable the embedded LLDP on Intel '
|
||||||
'card. Addresses of failed pci devices: {}'
|
'CNA network card. Addresses of failed pci '
|
||||||
.format(str(failed_dirs).strip('[]')))
|
'devices: %s', str(failed_dirs).strip('[]'))
|
||||||
|
LOG.warning(warning_msg)
|
||||||
|
|
||||||
|
|
||||||
class IntelCnaHardwareManager(hardware.HardwareManager):
|
class IntelCnaHardwareManager(hardware.HardwareManager):
|
||||||
|
@ -112,8 +112,8 @@ class TestIntelCnaHardwareManager(base.IronicAgentTest):
|
|||||||
cna._disable_embedded_lldp_agent_in_cna_card()
|
cna._disable_embedded_lldp_agent_in_cna_card()
|
||||||
expected_log_message = ('Failed to disable the embedded LLDP on '
|
expected_log_message = ('Failed to disable the embedded LLDP on '
|
||||||
'Intel CNA network card. Addresses of '
|
'Intel CNA network card. Addresses of '
|
||||||
'failed pci devices: {}'
|
'failed pci devices: %s',
|
||||||
.format(str(listdir_dict).strip('[]')))
|
str(listdir_dict).strip('[]'))
|
||||||
mock_log.warning.assert_called_once_with(expected_log_message)
|
mock_log.warning.assert_called_once_with(expected_log_message)
|
||||||
|
|
||||||
@mock.patch.object(cna, 'LOG', autospec=True)
|
@mock.patch.object(cna, 'LOG', autospec=True)
|
||||||
|
@ -865,8 +865,7 @@ def create_partition_table(dev_name, partition_table_type):
|
|||||||
:raises: CommandExecutionError if an error is encountered while
|
:raises: CommandExecutionError if an error is encountered while
|
||||||
attempting to create the partition table.
|
attempting to create the partition table.
|
||||||
"""
|
"""
|
||||||
LOG.info("Creating partition table on {}".format(
|
LOG.info("Creating partition table on %s", dev_name)
|
||||||
dev_name))
|
|
||||||
try:
|
try:
|
||||||
execute('parted', dev_name, '-s', '--',
|
execute('parted', dev_name, '-s', '--',
|
||||||
'mklabel', partition_table_type)
|
'mklabel', partition_table_type)
|
||||||
|
4
tox.ini
4
tox.ini
@ -35,10 +35,10 @@ commands = stestr run {posargs}
|
|||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
usedevelop = False
|
usedevelop = False
|
||||||
deps=
|
deps=
|
||||||
hacking>=3.1.0,<4.0.0 # Apache-2.0
|
hacking>=4.1.0,<5.0.0 # Apache-2.0
|
||||||
bashate>=0.5.1 # Apache-2.0
|
bashate>=0.5.1 # Apache-2.0
|
||||||
flake8-import-order>=0.17.1 # LGPLv3
|
flake8-import-order>=0.17.1 # LGPLv3
|
||||||
pycodestyle>=2.0.0,<2.7.0 # MIT
|
pycodestyle>=2.0.0,<3.0.0 # MIT
|
||||||
doc8>=0.8.1 # Apache-2.0
|
doc8>=0.8.1 # Apache-2.0
|
||||||
allowlist_externals = bash
|
allowlist_externals = bash
|
||||||
commands =
|
commands =
|
||||||
|
Loading…
Reference in New Issue
Block a user