[placement] annotate loadapp as public interface
When Change-Id: I61d20c5d19797f7e66648c7864a632f3328be8ce was under review there were questions about why the interface on deploy() was not changed to remove the no-longer used project_name kwarg. I mistakenly asserted that this was because it was a public interface for building a Placement WSGI application. That's not the case. loadapp() is the public interface. This change annotates loadapp() as such, and removes the unused arg deploy(). Change-Id: I9f3d03d964654ab1b9515ecd6fe35c518d5f496a Related-Bug: #1734491
This commit is contained in:
parent
f536d3bf23
commit
fc71fb891e
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue