diff --git a/ironic_python_agent/extensions/flow.py b/ironic_python_agent/extensions/flow.py index a080747a2..8ef17ca03 100644 --- a/ironic_python_agent/extensions/flow.py +++ b/ironic_python_agent/extensions/flow.py @@ -36,10 +36,10 @@ class FlowExtension(base.BaseAgentExtension, base.ExecuteCommandMixin): def start_flow(self, flow=None): for task in flow: for method, params in task.items(): - LOG.info("Executing method %s for now" % method) + LOG.info("Executing method %s for now", method) result = self.execute_command(method, **params) result.join() - LOG.info("%s method's execution is done" % method) + LOG.info("%s method's execution is done", method) if result.command_status == base.AgentCommandStatus.FAILED: raise errors.CommandExecutionError( "%s was failed" % method diff --git a/ironic_python_agent/extensions/image.py b/ironic_python_agent/extensions/image.py index 35c9f76d5..5eded3bfc 100644 --- a/ironic_python_agent/extensions/image.py +++ b/ironic_python_agent/extensions/image.py @@ -48,7 +48,7 @@ def _get_partition(device, uuid): utils.execute('udevadm', 'settle') except processutils.ProcessExecutionError: LOG.warning("Couldn't re-read the partition table " - "on device %s" % device) + "on device %s", device) report = utils.execute('lsblk', '-PbioKNAME,UUID,TYPE', device)[0] for line in report.split('\n'): diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py index bafd8a5fa..b89eb5ac1 100644 --- a/ironic_python_agent/hardware.py +++ b/ironic_python_agent/hardware.py @@ -697,8 +697,8 @@ class GenericHardwareManager(HardwareManager): 'agent_continue_if_ata_erase_failed', False) if execute_shred: LOG.warning('Failed to invoke ata_erase, ' - 'falling back to shred: %(err)s' - % {'err': e}) + 'falling back to shred: %(err)s', + {'err': e}) else: msg = ('Failed to invoke ata_erase, ' 'fallback to shred is not enabled: %(err)s' diff --git a/ironic_python_agent/ironic_api_client.py b/ironic_python_agent/ironic_api_client.py index d4acfb25a..9dd97496d 100644 --- a/ironic_python_agent/ironic_api_client.py +++ b/ironic_python_agent/ironic_api_client.py @@ -174,7 +174,7 @@ class APIClient(object): # Check for valid response data if 'node' not in content or 'uuid' not in content['node']: - LOG.warning('Got invalid node data from the API: %s' % content) + LOG.warning('Got invalid node data from the API: %s', content) return False if 'config' not in content: @@ -183,7 +183,7 @@ class APIClient(object): content['config'] = {'heartbeat_timeout': content.pop('heartbeat_timeout')} except KeyError: - LOG.warning('Got invalid heartbeat from the API: %s' % content) + LOG.warning('Got invalid heartbeat from the API: %s', content) return False # Got valid content diff --git a/test-requirements.txt b/test-requirements.txt index d2b4f5cd0..eea4ed819 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,7 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking<0.12,>=0.11.0 # Apache-2.0 +hacking<0.13,>=0.12.0 # Apache-2.0 coverage>=4.0 # Apache-2.0 mock>=2.0 # BSD testtools>=1.4.0 # MIT diff --git a/tox.ini b/tox.ini index e9a8d0852..25fe8b21d 100644 --- a/tox.ini +++ b/tox.ini @@ -57,6 +57,10 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen [flake8] ignore = E129 exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,imagebuild/tinyipa/tinyipafinal,imagebuild/tinyipa/tinyipabuild +# [H106] Don’t put vim configuration in source files. +# [H203] Use assertIs(Not)None to check for None. +# [H904] Delay string interpolations at logging calls. +enable-extensions=H106,H203,H904 [hacking] import_exceptions = ironic.openstack.common.gettextutils._,testtools.matchers