Moved memcached driver import to the top of modules.
This commit is contained in:
@@ -69,6 +69,12 @@ flags.DEFINE_string('ldap_developer',
|
|||||||
LOG = logging.getLogger("nova.ldapdriver")
|
LOG = logging.getLogger("nova.ldapdriver")
|
||||||
|
|
||||||
|
|
||||||
|
if FLAGS.memcached_servers:
|
||||||
|
import memcache
|
||||||
|
else:
|
||||||
|
from nova import fakememcache as memcache
|
||||||
|
|
||||||
|
|
||||||
# TODO(vish): make an abstract base class with the same public methods
|
# TODO(vish): make an abstract base class with the same public methods
|
||||||
# to define a set interface for AuthDrivers. I'm delaying
|
# to define a set interface for AuthDrivers. I'm delaying
|
||||||
# creating this now because I'm expecting an auth refactor
|
# creating this now because I'm expecting an auth refactor
|
||||||
@@ -121,10 +127,6 @@ class LdapDriver(object):
|
|||||||
LdapDriver.conn = self.ldap.initialize(FLAGS.ldap_url)
|
LdapDriver.conn = self.ldap.initialize(FLAGS.ldap_url)
|
||||||
LdapDriver.conn.simple_bind_s(FLAGS.ldap_user_dn, FLAGS.ldap_password)
|
LdapDriver.conn.simple_bind_s(FLAGS.ldap_user_dn, FLAGS.ldap_password)
|
||||||
if LdapDriver.mc is None:
|
if LdapDriver.mc is None:
|
||||||
if FLAGS.memcached_servers:
|
|
||||||
import memcache
|
|
||||||
else:
|
|
||||||
from nova import fakememcache as memcache
|
|
||||||
LdapDriver.mc = memcache.Client(FLAGS.memcached_servers, debug=0)
|
LdapDriver.mc = memcache.Client(FLAGS.memcached_servers, debug=0)
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
|
@@ -73,6 +73,12 @@ flags.DEFINE_string('auth_driver', 'nova.auth.dbdriver.DbDriver',
|
|||||||
LOG = logging.getLogger('nova.auth.manager')
|
LOG = logging.getLogger('nova.auth.manager')
|
||||||
|
|
||||||
|
|
||||||
|
if FLAGS.memcached_servers:
|
||||||
|
import memcache
|
||||||
|
else:
|
||||||
|
from nova import fakememcache as memcache
|
||||||
|
|
||||||
|
|
||||||
class AuthBase(object):
|
class AuthBase(object):
|
||||||
"""Base class for objects relating to auth
|
"""Base class for objects relating to auth
|
||||||
|
|
||||||
@@ -224,10 +230,6 @@ class AuthManager(object):
|
|||||||
if driver or not getattr(self, 'driver', None):
|
if driver or not getattr(self, 'driver', None):
|
||||||
self.driver = utils.import_class(driver or FLAGS.auth_driver)
|
self.driver = utils.import_class(driver or FLAGS.auth_driver)
|
||||||
if AuthManager.mc is None:
|
if AuthManager.mc is None:
|
||||||
if FLAGS.memcached_servers:
|
|
||||||
import memcache
|
|
||||||
else:
|
|
||||||
from nova import fakememcache as memcache
|
|
||||||
AuthManager.mc = memcache.Client(FLAGS.memcached_servers, debug=0)
|
AuthManager.mc = memcache.Client(FLAGS.memcached_servers, debug=0)
|
||||||
|
|
||||||
def authenticate(self, access, signature, params, verb='GET',
|
def authenticate(self, access, signature, params, verb='GET',
|
||||||
|
Reference in New Issue
Block a user