From: Dirk Mueller Date: Tue, 11 Jun 2013 18:17:18 +0000 (+0200) Subject: Gate on H703 X-Git-Tag: 2014.1~489^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=6e0807c225f93fac31f1f8599fa58f52527a6c66;p=openstack-build%2Fheat-build.git Gate on H703 Fix fallout by avoiding multiple positional arguments. Change-Id: Ie25f7b9041fa5df85a244cb237124440bb7d8e32 --- diff --git a/heat/api/cfn/v1/stacks.py b/heat/api/cfn/v1/stacks.py index dab7ad4a..def26b00 100644 --- a/heat/api/cfn/v1/stacks.py +++ b/heat/api/cfn/v1/stacks.py @@ -291,7 +291,7 @@ class StackController(object): return result if action not in self.CREATE_OR_UPDATE_ACTION: - msg = _('Unexpected action %s') % action + msg = _("Unexpected action %(action)s") % ({'action': action}) # This should not happen, so return HeatInternalFailureError return exception.HeatInternalFailureError(detail=msg) diff --git a/heat/api/middleware/version_negotiation.py b/heat/api/middleware/version_negotiation.py index c484d9e0..1aff84f6 100644 --- a/heat/api/middleware/version_negotiation.py +++ b/heat/api/middleware/version_negotiation.py @@ -56,19 +56,23 @@ class VersionNegotiationFilter(wsgi.Middleware): match = self._match_version_string(req.path_info_peek(), req) if match: - if (req.environ['api.major_version'] == 1 and - req.environ['api.minor_version'] == 0): - logger.debug(_("Matched versioned URI. Version: %d.%d"), - req.environ['api.major_version'], - req.environ['api.minor_version']) + major_version = req.environ['api.major_version'] + minor_version = req.environ['api.minor_version'] + + if (major_version == 1 and minor_version == 0): + logger.debug(_("Matched versioned URI. " + "Version: %(major_version)d.%(minor_version)d") + % {'major_version': major_version, + 'minor_version': minor_version}) # Strip the version from the path req.path_info_pop() return None else: - logger.debug(_("Unknown version in versioned URI: %d.%d. " - "Returning version choices."), - req.environ['api.major_version'], - req.environ['api.minor_version']) + logger.debug(_("Unknown version in versioned URI: " + "%(major_version)d.%(minor_version)d. " + "Returning version choices.") + % {'major_version': major_version, + 'minor_version': minor_version}) return self.versions_app accept = str(req.accept) @@ -77,18 +81,20 @@ class VersionNegotiationFilter(wsgi.Middleware): accept_version = accept[token_loc:] match = self._match_version_string(accept_version, req) if match: - if (req.environ['api.major_version'] == 1 and - req.environ['api.minor_version'] == 0): - logger.debug(_("Matched versioned media type. " - "Version: %d.%d"), - req.environ['api.major_version'], - req.environ['api.minor_version']) + major_version = req.environ['api.major_version'] + minor_version = req.environ['api.minor_version'] + if (major_version == 1 and minor_version == 0): + logger.debug(_("Matched versioned media type. Version: " + "%(major_version)d.%(minor_version)d") + % {'major_version': major_version, + 'minor_version': minor_version}) return None else: - logger.debug(_("Unknown version in accept header: %d.%d..." - "returning version choices."), - req.environ['api.major_version'], - req.environ['api.minor_version']) + logger.debug(_("Unknown version in accept header: " + "%(major_version)d.%(minor_version)d..." + "returning version choices.") + % {'major_version': major_version, + 'minor_version': minor_version}) return self.versions_app else: if req.accept not in ('*/*', ''): diff --git a/heat/common/auth.py b/heat/common/auth.py index 4064f1e9..290de4e1 100644 --- a/heat/common/auth.py +++ b/heat/common/auth.py @@ -176,7 +176,9 @@ class KeystoneStrategy(BaseStrategy): elif resp.status == 404: raise exception.AuthUrlNotFound(url=token_url) else: - raise Exception(_('Unexpected response: %s') % resp.status) + status = resp.status + raise Exception(_('Unexpected response: %(status)s') + % {'status': resp.status}) def _v2_auth(self, token_url): def get_endpoint(service_catalog): diff --git a/heat/common/wsgi.py b/heat/common/wsgi.py index fcfa2742..d152f26e 100644 --- a/heat/common/wsgi.py +++ b/heat/common/wsgi.py @@ -130,8 +130,9 @@ def get_socket(conf, default_port): raise eventlet.sleep(0.1) if not sock: - raise RuntimeError(_("Could not bind to %s:%s after trying for 30 " - "seconds") % bind_addr) + raise RuntimeError(_("Could not bind to %(bind_addr)s" + "after trying for 30 seconds") + % {'bind_addr': bind_addr}) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # in my experience, sockets can hang around forever without keepalive sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) diff --git a/tox.ini b/tox.ini index 46d7f085..1dde0d5f 100644 --- a/tox.ini +++ b/tox.ini @@ -22,7 +22,6 @@ commands = python setup.py testr --coverage [flake8] -ignore = F403,F841,H201,H302,H303,H306,H404,H703 # F403 'from sqlalchemy import *' used; unable to detect undefined names # F841 local variable 'json_template' is assigned to but never used # H201 no 'except:' at least use 'except Exception:' @@ -30,7 +29,7 @@ ignore = F403,F841,H201,H302,H303,H306,H404,H703 # H303 No wildcard (*) import. # H306 imports not in alphabetical order # H404 multi line docstring should start with a summary -# H703 Multiple positional placeholders +ignore = F403,F841,H201,H302,H303,H306,H404 show-source = true builtins = _ exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,build