Merge "Store config in drivers and use it to get list_limit"

This commit is contained in:
Jenkins 2016-02-03 22:09:00 +00:00 committed by Gerrit Code Review
commit 554c71e5cf
3 changed files with 14 additions and 4 deletions

View File

@ -41,9 +41,11 @@ class Identity(identity.IdentityDriverV8):
def __init__(self, conf=None):
super(Identity, self).__init__()
if conf is None:
conf = CONF
self.user = UserApi(conf)
self.group = GroupApi(conf)
self.conf = CONF
else:
self.conf = conf
self.user = UserApi(self.conf)
self.group = GroupApi(self.conf)
def default_assignment_driver(self):
return 'ldap'

View File

@ -76,6 +76,7 @@ class Identity(identity.IdentityDriverV8):
# NOTE(henry-nash): Override the __init__() method so as to take a
# config parameter to enable sql to be used as a domain-specific driver.
def __init__(self, conf=None):
self.conf = conf
super(Identity, self).__init__()
def default_assignment_driver(self):

View File

@ -1165,8 +1165,15 @@ class Manager(manager.Manager):
class IdentityDriverV8(object):
"""Interface description for an Identity driver."""
def _get_conf(self):
try:
return self.conf or CONF
except AttributeError:
return CONF
def _get_list_limit(self):
return CONF.identity.list_limit or CONF.list_limit
conf = self._get_conf()
return conf.identity.list_limit or conf.list_limit
def is_domain_aware(self):
"""Indicates if Driver supports domains."""