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

View File

@ -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 ('*/*', ''):

View File

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

View File

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

View File

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