Dependency cleanup

Clean up dependency usage.

a) If the class uses a dependency directly, make sure it's
included (getting from superclass isn't enough)

b) If the class doesn't use a dependency directly, make
sure it's NOT included (being a superclass isn't excuse)

Change-Id: Ifbd489f349ec019a41093a2814664e6d8c9f0069
changes/34/54834/3
Brant Knudson 9 years ago
parent 5e24b7627a
commit 4bd8bf6a32
  1. 2
      keystone/auth/controllers.py
  2. 2
      keystone/auth/core.py
  3. 2
      keystone/auth/plugins/password.py
  4. 6
      keystone/common/controller.py
  5. 2
      keystone/contrib/ec2/controllers.py
  6. 2
      keystone/contrib/endpoint_filter/controllers.py
  7. 7
      keystone/contrib/oauth1/controllers.py
  8. 2
      keystone/credential/controllers.py
  9. 10
      keystone/identity/controllers.py
  10. 2
      keystone/policy/controllers.py
  11. 3
      keystone/token/controllers.py
  12. 6
      keystone/token/providers/uuid.py

@ -272,7 +272,7 @@ class AuthInfo(object):
self._scope_data = (domain_id, project_id, trust)
@dependency.requires('token_provider_api')
@dependency.requires('identity_api', 'token_provider_api')
class Auth(controller.V3Controller):
def __init__(self, *args, **kw):
super(Auth, self).__init__(*args, **kw)

@ -18,11 +18,9 @@ import abc
import six
from keystone.common import dependency
from keystone import exception
@dependency.requires('identity_api')
@six.add_metaclass(abc.ABCMeta)
class AuthMethodHandler(object):
"""Abstract base class for an authentication plugin."""

@ -15,6 +15,7 @@
# under the License.
from keystone import auth
from keystone.common import dependency
from keystone import exception
from keystone import identity
from keystone.openstack.common import log as logging
@ -97,6 +98,7 @@ class UserAuthInfo(object):
self.domain_id = domain_ref['id']
@dependency.requires('identity_api')
class Password(auth.AuthMethodHandler):
def authenticate(self, context, auth_payload, user_context):
"""Try to authenticate against the identity backend."""

@ -202,9 +202,8 @@ def filterprotected(*filters):
return _filterprotected
@dependency.requires('identity_api', 'policy_api', 'token_api',
'trust_api', 'catalog_api', 'credential_api',
'assignment_api')
@dependency.requires('assignment_api', 'identity_api', 'policy_api',
'token_api', 'trust_api')
class V2Controller(wsgi.Application):
"""Base controller class for Identity API v2."""
@ -314,6 +313,7 @@ class V2Controller(wsgi.Application):
return ref
@dependency.requires('identity_api', 'policy_api', 'token_api')
class V3Controller(V2Controller):
"""Base controller class for Identity API v3.

@ -46,7 +46,7 @@ from keystone import token
@dependency.requires('assignment_api', 'catalog_api', 'credential_api',
'token_provider_api')
'identity_api', 'token_api', 'token_provider_api')
class Ec2Controller(controller.V2Controller):
def check_signature(self, creds_ref, credentials):
signer = ec2_utils.Ec2Signer(creds_ref['secret'])

@ -21,7 +21,7 @@ from keystone.common import dependency
from keystone.identity import controllers as identity_controllers
@dependency.requires('assignment_api', 'endpoint_filter_api')
@dependency.requires('assignment_api', 'catalog_api', 'endpoint_filter_api')
class EndpointFilterV3Controller(controller.V3Controller):
@controller.protected()

@ -71,7 +71,7 @@ class ConsumerCrudV3(controller.V3Controller):
raise exception.ValidationError(message=msg)
@dependency.requires('oauth_api')
@dependency.requires('oauth_api', 'token_api')
class AccessTokenCrudV3(controller.V3Controller):
collection_name = 'access_tokens'
member_name = 'access_token'
@ -120,7 +120,7 @@ class AccessTokenCrudV3(controller.V3Controller):
return formatted_entity
@dependency.requires('oauth_api', 'assignment_api')
@dependency.requires('assignment_api', 'oauth_api')
class AccessTokenRolesV3(controller.V3Controller):
collection_name = 'roles'
member_name = 'role'
@ -159,8 +159,7 @@ class AccessTokenRolesV3(controller.V3Controller):
return formatted_entity
@dependency.requires('oauth_api', 'token_api', 'identity_api',
'token_provider_api', 'assignment_api')
@dependency.requires('assignment_api', 'oauth_api', 'token_api')
class OAuthControllerV3(controller.V3Controller):
collection_name = 'not_used'
member_name = 'not_used'

@ -18,9 +18,11 @@ import hashlib
import json
from keystone.common import controller
from keystone.common import dependency
from keystone import exception
@dependency.requires('credential_api')
class CredentialV3(controller.V3Controller):
collection_name = 'credentials'
member_name = 'credential'

@ -22,6 +22,7 @@ import urlparse
import uuid
from keystone.common import controller
from keystone.common import dependency
from keystone import config
from keystone import exception
from keystone.openstack.common import log as logging
@ -31,6 +32,7 @@ DEFAULT_DOMAIN_ID = CONF.identity.default_domain_id
LOG = logging.getLogger(__name__)
@dependency.requires('assignment_api', 'identity_api', 'token_api')
class Tenant(controller.V2Controller):
def get_all_projects(self, context, **kw):
"""Gets a list of all tenants for an admin user."""
@ -167,6 +169,7 @@ class Tenant(controller.V2Controller):
return o
@dependency.requires('assignment_api', 'identity_api')
class User(controller.V2Controller):
def get_user(self, context, user_id):
self.assert_admin(context)
@ -313,6 +316,7 @@ class User(controller.V2Controller):
return ref
@dependency.requires('assignment_api', 'identity_api')
class Role(controller.V2Controller):
# COMPAT(essex-3)
def get_user_roles(self, context, user_id, tenant_id=None):
@ -469,6 +473,7 @@ class Role(controller.V2Controller):
self._delete_tokens_for_user(user_id)
@dependency.requires('assignment_api', 'identity_api')
class DomainV3(controller.V3Controller):
collection_name = 'domains'
member_name = 'domain'
@ -616,6 +621,7 @@ class DomainV3(controller.V3Controller):
return {'domain': ref}
@dependency.requires('assignment_api', 'credential_api')
class ProjectV3(controller.V3Controller):
collection_name = 'projects'
member_name = 'project'
@ -678,6 +684,7 @@ class ProjectV3(controller.V3Controller):
return self._delete_project(context, project_id)
@dependency.requires('identity_api', 'credential_api')
class UserV3(controller.V3Controller):
collection_name = 'users'
member_name = 'user'
@ -777,6 +784,7 @@ class UserV3(controller.V3Controller):
return self._delete_user(context, user_id)
@dependency.requires('identity_api')
class GroupV3(controller.V3Controller):
collection_name = 'groups'
member_name = 'group'
@ -842,6 +850,7 @@ class GroupV3(controller.V3Controller):
return self._delete_group(context, group_id)
@dependency.requires('assignment_api', 'identity_api')
class RoleV3(controller.V3Controller):
collection_name = 'roles'
member_name = 'role'
@ -986,6 +995,7 @@ class RoleV3(controller.V3Controller):
self._delete_tokens_for_group(group_id)
@dependency.requires('assignment_api', 'identity_api')
class RoleAssignmentV3(controller.V3Controller):
# TODO(henry-nash): The current implementation does not provide a full

@ -15,8 +15,10 @@
# under the License.
from keystone.common import controller
from keystone.common import dependency
@dependency.requires('policy_api')
class PolicyV3(controller.V3Controller):
collection_name = 'policies'
member_name = 'policy'

@ -37,7 +37,8 @@ class ExternalAuthNotApplicable(Exception):
pass
@dependency.requires('token_provider_api')
@dependency.requires('assignment_api', 'catalog_api', 'identity_api',
'token_api', 'token_provider_api', 'trust_api')
class Auth(controller.V2Controller):
def ca_cert(self, context, auth=None):
ca_file = open(CONF.signing.ca_certs, 'r')

@ -36,7 +36,6 @@ CONF = config.CONF
DEFAULT_DOMAIN_ID = CONF.identity.default_domain_id
@dependency.requires('assignment_api', 'catalog_api', 'identity_api')
class V2TokenDataHelper(object):
"""Creates V2 token data."""
@classmethod
@ -132,7 +131,8 @@ class V2TokenDataHelper(object):
return services.values()
@dependency.requires('assignment_api', 'catalog_api', 'identity_api')
@dependency.requires('assignment_api', 'catalog_api', 'identity_api',
'trust_api')
class V3TokenDataHelper(object):
"""Token data helper."""
def __init__(self):
@ -330,7 +330,7 @@ class V3TokenDataHelper(object):
@dependency.optional('oauth_api')
@dependency.requires('assignment_api', 'catalog_api', 'identity_api',
'token_api')
'token_api', 'trust_api')
class Provider(token.provider.Provider):
def __init__(self, *args, **kwargs):
super(Provider, self).__init__(*args, **kwargs)

Loading…
Cancel
Save