Don't allow legacy and native flask to share paths
When a path-prefix is moved to flask native dispatching, no longer allow that path prefix to be registered with the legacy dispatch middleware. This will ensure the entire Keystone path is moved and prevent bad behavior due to both dispatchers needing ot handle a URL. Change-Id: Ice800abf80a725349d6450b742a2c48238e11e6e Partial-Bug: #1776504
This commit is contained in:
parent
dbc2ac06b8
commit
0d6b427fcc
|
@ -43,7 +43,9 @@ from keystone.revoke import routers as revoke_routers
|
|||
from keystone.token import _simple_cert as simple_cert_ext
|
||||
from keystone.trust import routers as trust_routers
|
||||
|
||||
|
||||
# TODO(morgan): _MOVED_API_PREFIXES to be removed when the legacy dispatch
|
||||
# support is removed.
|
||||
_MOVED_API_PREFIXES = frozenset([])
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -208,6 +210,16 @@ def application_factory(name='public'):
|
|||
sub_routers = []
|
||||
mapper = routes.Mapper()
|
||||
for api_routers in ALL_API_ROUTERS:
|
||||
moved_found = [pfx for
|
||||
pfx in getattr(api_routers, '_path_prefixes', [])
|
||||
if pfx in _MOVED_API_PREFIXES]
|
||||
if moved_found:
|
||||
raise RuntimeError('An API Router is trying to register path '
|
||||
'prefix(s) `%(pfx)s` that is handled by the '
|
||||
'native Flask app. Keystone cannot '
|
||||
'start.' %
|
||||
{'pfx': ', '.join([p for p in moved_found])})
|
||||
|
||||
routers_instance = api_routers.Routers()
|
||||
_routers.append(routers_instance)
|
||||
routers_instance.append_v3_routers(mapper, sub_routers)
|
||||
|
|
Loading…
Reference in New Issue