Enables Hacking extensions H106,H203,H904

These Hacking checks are enabled in Tempest[1], so we might as well
include them here.

For info:

* 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

More on this can be found in the Hacking doc[2].

 [1]: https://git.openstack.org/cgit/openstack/tempest/tree/tox.ini?h=master#n149
 [2]: https://pypi.python.org/pypi/hacking

Change-Id: Id2fd27f726811eeea682227f3566dbe0b011a8b0
This commit is contained in:
Joe H. Rahme 2017-01-25 16:14:59 +01:00
parent 110b7338e9
commit 25e0580394
3 changed files with 7 additions and 6 deletions

View File

@ -53,7 +53,7 @@ class Service(object):
http = urllib3.PoolManager()
r = http.request('GET', url, headers=self.headers)
except Exception as e:
LOG.error("Request on service '%s' with url '%s' failed" %
LOG.error("Request on service '%s' with url '%s' failed",
(self.name, url))
raise e
if r.status >= 400:
@ -153,8 +153,8 @@ def get_identity_v3_extensions(keystone_v3_url):
verify=False,
headers={'Accept': 'application/json-home'})
except requests.exceptions.RequestException as re:
LOG.error("Request on service '%s' with url '%s' failed" %
('identity', keystone_v3_url))
LOG.error("Request on service '%s' with url '%s' failed",
'identity', keystone_v3_url)
raise re
ext_h = 'http://docs.openstack.org/api/openstack-identity/3/ext/'
res = [x for x in json.loads(r.content)['resources'].keys()]

View File

@ -176,7 +176,7 @@ def main():
configure_discovered_services(conf, services)
configure_boto(conf, services)
configure_horizon(conf)
LOG.info("Creating configuration file %s" % os.path.abspath(args.out))
LOG.info("Creating configuration file %s", os.path.abspath(args.out))
with open(args.out, 'w') as f:
conf.write(f)
@ -505,7 +505,7 @@ def give_role_to_user(tenants_client, roles_client, users_client, username,
if not role_ids:
if role_required:
raise Exception("required role %s not found" % role_name)
LOG.debug("%s role not required" % role_name)
LOG.debug("%s role not required", role_name)
return
role_id = role_ids[0]
try:
@ -809,7 +809,7 @@ def _download_file(url, destination):
def _download_image(client, id, path):
"""Download file from glance."""
LOG.info("Downloading image %s to %s" % (id, path))
LOG.info("Downloading image %s to %s", (id, path))
body = client.show_image_file(id)
LOG.debug(type(body.data))
with open(path, 'wb') as out:

View File

@ -36,5 +36,6 @@ commands = oslo_debug_helper {posargs}
show-source = True
ignore = E123,E125
enable-extensions = H106,H230,H904
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build