Merge "[placement] annotate loadapp as public interface"

This commit is contained in:
Zuul 2018-02-12 21:18:56 +00:00 committed by Gerrit Code Review
commit a5a569d667
2 changed files with 17 additions and 3 deletions

View File

@ -32,7 +32,7 @@ NAME = "nova"
objects.register_all()
def deploy(conf, project_name):
def deploy(conf):
"""Assemble the middleware pipeline leading to the placement app."""
if conf.api.auth_strategy == 'noauth2':
auth_middleware = auth.NoAuthMiddleware
@ -83,6 +83,20 @@ def deploy(conf, project_name):
return application
# NOTE(cdent): Althought project_name is no longer used because of the
# resolution of https://bugs.launchpad.net/nova/+bug/1734491, loadapp()
# is considered a public interface for the creation of a placement
# WSGI app so must maintain its interface. The canonical placement WSGI
# app is created by init_application in wsgi.py, but this is not
# required and in fact can be limiting. loadapp() may be used from
# fixtures or arbitrary WSGI frameworks and loaders.
def loadapp(config, project_name=NAME):
application = deploy(config, project_name)
"""WSGI application creator for placement.
:param config: An olso_config.cfg.ConfigOpts containing placement
configuration.
:param project_name: oslo_config project name. Ignored, preserved for
backwards compatibility
"""
application = deploy(config)
return application

View File

@ -34,7 +34,7 @@ class DeployTest(test.NoDBTestCase):
self.flags(auth_uri=auth_uri, group='keystone_authtoken')
# ensure that the auth_token middleware is chosen
self.flags(auth_strategy='keystone', group='api')
app = deploy.deploy(CONF, 'nova')
app = deploy.deploy(CONF)
req = webob.Request.blank('/resource_providers', method="GET")
response = req.get_response(app)