Merge "Gate on H703"

This commit is contained in:
Jenkins 2013-06-14 08:53:26 +00:00 committed by Gerrit Code Review
commit 440ada0c61
5 changed files with 33 additions and 25 deletions

View File

@ -291,7 +291,7 @@ class StackController(object):
return result return result
if action not in self.CREATE_OR_UPDATE_ACTION: 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 # This should not happen, so return HeatInternalFailureError
return exception.HeatInternalFailureError(detail=msg) return exception.HeatInternalFailureError(detail=msg)

View File

@ -56,19 +56,23 @@ class VersionNegotiationFilter(wsgi.Middleware):
match = self._match_version_string(req.path_info_peek(), req) match = self._match_version_string(req.path_info_peek(), req)
if match: if match:
if (req.environ['api.major_version'] == 1 and major_version = req.environ['api.major_version']
req.environ['api.minor_version'] == 0): minor_version = req.environ['api.minor_version']
logger.debug(_("Matched versioned URI. Version: %d.%d"),
req.environ['api.major_version'], if (major_version == 1 and minor_version == 0):
req.environ['api.minor_version']) 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 # Strip the version from the path
req.path_info_pop() req.path_info_pop()
return None return None
else: else:
logger.debug(_("Unknown version in versioned URI: %d.%d. " logger.debug(_("Unknown version in versioned URI: "
"Returning version choices."), "%(major_version)d.%(minor_version)d. "
req.environ['api.major_version'], "Returning version choices.")
req.environ['api.minor_version']) % {'major_version': major_version,
'minor_version': minor_version})
return self.versions_app return self.versions_app
accept = str(req.accept) accept = str(req.accept)
@ -77,18 +81,20 @@ class VersionNegotiationFilter(wsgi.Middleware):
accept_version = accept[token_loc:] accept_version = accept[token_loc:]
match = self._match_version_string(accept_version, req) match = self._match_version_string(accept_version, req)
if match: if match:
if (req.environ['api.major_version'] == 1 and major_version = req.environ['api.major_version']
req.environ['api.minor_version'] == 0): minor_version = req.environ['api.minor_version']
logger.debug(_("Matched versioned media type. " if (major_version == 1 and minor_version == 0):
"Version: %d.%d"), logger.debug(_("Matched versioned media type. Version: "
req.environ['api.major_version'], "%(major_version)d.%(minor_version)d")
req.environ['api.minor_version']) % {'major_version': major_version,
'minor_version': minor_version})
return None return None
else: else:
logger.debug(_("Unknown version in accept header: %d.%d..." logger.debug(_("Unknown version in accept header: "
"returning version choices."), "%(major_version)d.%(minor_version)d..."
req.environ['api.major_version'], "returning version choices.")
req.environ['api.minor_version']) % {'major_version': major_version,
'minor_version': minor_version})
return self.versions_app return self.versions_app
else: else:
if req.accept not in ('*/*', ''): if req.accept not in ('*/*', ''):

View File

@ -176,7 +176,9 @@ class KeystoneStrategy(BaseStrategy):
elif resp.status == 404: elif resp.status == 404:
raise exception.AuthUrlNotFound(url=token_url) raise exception.AuthUrlNotFound(url=token_url)
else: 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 _v2_auth(self, token_url):
def get_endpoint(service_catalog): def get_endpoint(service_catalog):

View File

@ -130,8 +130,9 @@ def get_socket(conf, default_port):
raise raise
eventlet.sleep(0.1) eventlet.sleep(0.1)
if not sock: if not sock:
raise RuntimeError(_("Could not bind to %s:%s after trying for 30 " raise RuntimeError(_("Could not bind to %(bind_addr)s"
"seconds") % bind_addr) "after trying for 30 seconds")
% {'bind_addr': bind_addr})
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# in my experience, sockets can hang around forever without keepalive # in my experience, sockets can hang around forever without keepalive
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)

View File

@ -22,7 +22,6 @@ commands =
python setup.py testr --coverage python setup.py testr --coverage
[flake8] [flake8]
ignore = F403,F841,H201,H302,H303,H306,H404,H703
# F403 'from sqlalchemy import *' used; unable to detect undefined names # F403 'from sqlalchemy import *' used; unable to detect undefined names
# F841 local variable 'json_template' is assigned to but never used # F841 local variable 'json_template' is assigned to but never used
# H201 no 'except:' at least use 'except Exception:' # 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. # H303 No wildcard (*) import.
# H306 imports not in alphabetical order # H306 imports not in alphabetical order
# H404 multi line docstring should start with a summary # H404 multi line docstring should start with a summary
# H703 Multiple positional placeholders ignore = F403,F841,H201,H302,H303,H306,H404
show-source = true show-source = true
builtins = _ builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,build exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,build