Remove exposure of routers at package level
Keystone API routers are exposed at their package level (in __init__.py files). This causes them to be unnecessarily executed each time something whithin that package is used. For example, simply importing keystone.federation.constants would make the federation routers code to be executed. This patch remove routers exposure from package level and import them directly in services.py, which is the single place that needs them. Change-Id: If68184c871ac77659ad2e64aa5f0aafac7a4bf70
This commit is contained in:
parent
8dd27d3368
commit
e64a1b5891
@ -14,4 +14,3 @@
|
||||
|
||||
from keystone.assignment import controllers # noqa
|
||||
from keystone.assignment.core import * # noqa
|
||||
from keystone.assignment import routers # noqa
|
||||
|
@ -14,4 +14,3 @@
|
||||
|
||||
from keystone.auth import controllers # noqa
|
||||
from keystone.auth.core import * # noqa
|
||||
from keystone.auth import routers # noqa
|
||||
|
@ -14,4 +14,3 @@
|
||||
|
||||
from keystone.catalog import controllers # noqa
|
||||
from keystone.catalog.core import * # noqa
|
||||
from keystone.catalog import routers # noqa
|
||||
|
@ -14,4 +14,3 @@
|
||||
|
||||
from keystone.credential import controllers # noqa
|
||||
from keystone.credential.core import * # noqa
|
||||
from keystone.credential import routers # noqa
|
||||
|
@ -11,4 +11,3 @@
|
||||
# under the License.
|
||||
|
||||
from keystone.endpoint_policy.core import * # noqa
|
||||
from keystone.endpoint_policy import routers # noqa
|
||||
|
@ -13,4 +13,3 @@
|
||||
# under the License.
|
||||
|
||||
from keystone.federation.core import * # noqa
|
||||
from keystone.federation import routers # noqa
|
||||
|
@ -15,4 +15,3 @@
|
||||
from keystone.identity import controllers # noqa
|
||||
from keystone.identity.core import * # noqa
|
||||
from keystone.identity import generator # noqa
|
||||
from keystone.identity import routers # noqa
|
||||
|
@ -13,4 +13,3 @@
|
||||
# under the License.
|
||||
|
||||
from keystone.oauth1.core import * # noqa
|
||||
from keystone.oauth1 import routers # noqa
|
||||
|
@ -14,4 +14,3 @@
|
||||
|
||||
from keystone.policy import controllers # noqa
|
||||
from keystone.policy.core import * # noqa
|
||||
from keystone.policy import routers # noqa
|
||||
|
@ -12,4 +12,3 @@
|
||||
|
||||
from keystone.resource import controllers # noqa
|
||||
from keystone.resource.core import * # noqa
|
||||
from keystone.resource import routers # noqa
|
||||
|
@ -11,4 +11,3 @@
|
||||
# under the License.
|
||||
|
||||
from keystone.revoke.core import * # noqa
|
||||
from keystone.revoke.routers import * # noqa
|
||||
|
@ -15,4 +15,3 @@
|
||||
from keystone.token import controllers # noqa
|
||||
from keystone.token import persistence # noqa
|
||||
from keystone.token import provider # noqa
|
||||
from keystone.token import routers # noqa
|
||||
|
@ -14,4 +14,3 @@
|
||||
|
||||
from keystone.trust import controllers # noqa
|
||||
from keystone.trust.core import * # noqa
|
||||
from keystone.trust import routers # noqa
|
||||
|
@ -20,21 +20,21 @@ from oslo_log import log
|
||||
from paste import deploy
|
||||
import routes
|
||||
|
||||
from keystone import assignment
|
||||
from keystone import auth
|
||||
from keystone import catalog
|
||||
from keystone.assignment import routers as assignment_routers
|
||||
from keystone.auth import routers as auth_routers
|
||||
from keystone.catalog import routers as catalog_routers
|
||||
from keystone.common import wsgi
|
||||
from keystone import credential
|
||||
from keystone import endpoint_policy
|
||||
from keystone import federation
|
||||
from keystone.credential import routers as credential_routers
|
||||
from keystone.endpoint_policy import routers as endpoint_policy_routers
|
||||
from keystone.federation import routers as federation_routers
|
||||
from keystone.i18n import _LW
|
||||
from keystone import identity
|
||||
from keystone import oauth1
|
||||
from keystone import policy
|
||||
from keystone import resource
|
||||
from keystone import revoke
|
||||
from keystone import token
|
||||
from keystone import trust
|
||||
from keystone.identity import routers as identity_routers
|
||||
from keystone.oauth1 import routers as oauth1_routers
|
||||
from keystone.policy import routers as policy_routers
|
||||
from keystone.resource import routers as resource_routers
|
||||
from keystone.revoke import routers as revoke_routers
|
||||
from keystone.token import routers as token_routers
|
||||
from keystone.trust import routers as trust_routers
|
||||
from keystone.version import controllers
|
||||
from keystone.version import routers
|
||||
|
||||
@ -82,8 +82,8 @@ def warn_local_conf(f):
|
||||
def public_app_factory(global_conf, **local_conf):
|
||||
controllers.register_version('v2.0')
|
||||
return wsgi.ComposingRouter(routes.Mapper(),
|
||||
[assignment.routers.Public(),
|
||||
token.routers.Router(),
|
||||
[assignment_routers.Public(),
|
||||
token_routers.Router(),
|
||||
routers.VersionV2('public'),
|
||||
routers.Extension(False)])
|
||||
|
||||
@ -93,10 +93,10 @@ def public_app_factory(global_conf, **local_conf):
|
||||
def admin_app_factory(global_conf, **local_conf):
|
||||
controllers.register_version('v2.0')
|
||||
return wsgi.ComposingRouter(routes.Mapper(),
|
||||
[identity.routers.Admin(),
|
||||
assignment.routers.Admin(),
|
||||
token.routers.Router(),
|
||||
resource.routers.Admin(),
|
||||
[identity_routers.Admin(),
|
||||
assignment_routers.Admin(),
|
||||
token_routers.Router(),
|
||||
resource_routers.Admin(),
|
||||
routers.VersionV2('admin'),
|
||||
routers.Extension()])
|
||||
|
||||
@ -126,25 +126,25 @@ def v3_app_factory(global_conf, **local_conf):
|
||||
# NOTE(dstanek): Routers should be ordered by their frequency of use in
|
||||
# a live system. This is due to the routes implementation. The most
|
||||
# frequently used routers should appear first.
|
||||
router_modules = [auth,
|
||||
assignment,
|
||||
catalog,
|
||||
credential,
|
||||
identity,
|
||||
policy,
|
||||
resource,
|
||||
revoke,
|
||||
federation,
|
||||
oauth1]
|
||||
all_api_routers = [auth_routers,
|
||||
assignment_routers,
|
||||
catalog_routers,
|
||||
credential_routers,
|
||||
identity_routers,
|
||||
policy_routers,
|
||||
resource_routers,
|
||||
revoke_routers,
|
||||
federation_routers,
|
||||
oauth1_routers]
|
||||
|
||||
if CONF.trust.enabled:
|
||||
router_modules.append(trust)
|
||||
all_api_routers.append(trust_routers)
|
||||
|
||||
if CONF.endpoint_policy.enabled:
|
||||
router_modules.append(endpoint_policy)
|
||||
all_api_routers.append(endpoint_policy_routers)
|
||||
|
||||
for module in router_modules:
|
||||
routers_instance = module.routers.Routers()
|
||||
for api_routers in all_api_routers:
|
||||
routers_instance = api_routers.Routers()
|
||||
_routers.append(routers_instance)
|
||||
routers_instance.append_v3_routers(mapper, sub_routers)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user