Update to hacking 0.12.0 and use new checks

Use hacking 0.12.0

Use the new checks that are available:
    [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.

Fix code so tests pass.

Change-Id: If22ad272c332f30624ce10861408d377908b152b
Depends-On: I2aa44b62f900d4dfd67701b01eadd0523fbfaf07
This commit is contained in:
John L. Villalovos 2016-11-08 11:08:21 -08:00
parent fb3a56d185
commit 0b8763e332
6 changed files with 12 additions and 8 deletions

View File

@ -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

View File

@ -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'):

View File

@ -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'

View File

@ -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

View File

@ -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

View File

@ -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] Dont 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