Refactor pipeline definition
This introduces a new pipeline_factory so that we can use a single entry to define pipeline for each deployment flavor. Change-Id: Ia9b251f0e48f69baa0c5c988b91b216a627ed028
This commit is contained in:
parent
fa9450d5b5
commit
7ab9001750
@ -4,53 +4,44 @@ paste.composite_factory = glance.api:root_app_factory
|
||||
/: api
|
||||
/healthcheck: healthcheck
|
||||
|
||||
[pipeline:api]
|
||||
pipeline = cors http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context rootapp
|
||||
|
||||
# Use this composite for image caching and no auth
|
||||
[composite:glance-api-caching]
|
||||
paste.composite_factory = glance.api:root_app_factory
|
||||
/: api-caching
|
||||
/: api
|
||||
/healthcheck: healthcheck
|
||||
|
||||
[pipeline:api-caching]
|
||||
pipeline = cors http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache rootapp
|
||||
|
||||
# Use this composite for caching w/ management interface but no auth
|
||||
[composite:glance-api-cachemanagement]
|
||||
paste.composite_factory = glance.api:root_app_factory
|
||||
/: api-cachemanagement
|
||||
/: api
|
||||
/healthcheck: healthcheck
|
||||
|
||||
[pipeline:api-cachemanagement]
|
||||
pipeline = cors http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache cachemanage rootapp
|
||||
|
||||
# Use this composite for keystone auth
|
||||
[composite:glance-api-keystone]
|
||||
paste.composite_factory = glance.api:root_app_factory
|
||||
/: api-keystone
|
||||
/: api
|
||||
/healthcheck: healthcheck
|
||||
|
||||
[pipeline:api-keystone]
|
||||
pipeline = cors http_proxy_to_wsgi versionnegotiation osprofiler authtoken context rootapp
|
||||
|
||||
# Use this composite for keystone auth with image caching
|
||||
[composite:glance-api-keystone+caching]
|
||||
paste.composite_factory = glance.api:root_app_factory
|
||||
/: api-keystone+caching
|
||||
/: api
|
||||
/healthcheck: healthcheck
|
||||
|
||||
[pipeline:api-keystone+caching]
|
||||
pipeline = cors http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache rootapp
|
||||
|
||||
# Use this composite for keystone auth with caching and cache management
|
||||
[composite:glance-api-keystone+cachemanagement]
|
||||
paste.composite_factory = glance.api:root_app_factory
|
||||
/: api-keystone+cachemanagement
|
||||
/healthcheck: healthcheck
|
||||
/: api
|
||||
/healthchetck: healthcheck
|
||||
|
||||
[pipeline:api-keystone+cachemanagement]
|
||||
pipeline = cors http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache cachemanage rootapp
|
||||
[composite:api]
|
||||
paste.composite_factory = glance.api:pipeline_factory
|
||||
default = cors http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context rootapp
|
||||
caching = cors http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache rootapp
|
||||
cachemanagement = cors http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache cachemanage rootapp
|
||||
keystone = cors http_proxy_to_wsgi versionnegotiation osprofiler authtoken context rootapp
|
||||
keystone+caching = cors http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache rootapp
|
||||
keystone+cachemanagement = cors http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache cachemanage rootapp
|
||||
|
||||
[composite:rootapp]
|
||||
paste.composite_factory = glance.api:root_app_factory
|
||||
|
@ -21,3 +21,15 @@ CONF = cfg.CONF
|
||||
|
||||
def root_app_factory(loader, global_conf, **local_conf):
|
||||
return paste.urlmap.urlmap_factory(loader, global_conf, **local_conf)
|
||||
|
||||
|
||||
def pipeline_factory(loader, global_conf, **local_conf):
|
||||
"""A paste pipeline replica that keys off of deployment flavor."""
|
||||
pipeline = local_conf[CONF.paste_deploy.flavor or 'default']
|
||||
pipeline = pipeline.split()
|
||||
filters = [loader.get_filter(n) for n in pipeline[:-1]]
|
||||
app = loader.get_app(pipeline[-1])
|
||||
filters.reverse()
|
||||
for filter in filters:
|
||||
app = filter(app)
|
||||
return app
|
||||
|
Loading…
x
Reference in New Issue
Block a user