summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorYuriy Taraday <yorik.sar@gmail.com>2011-06-01 18:32:49 +0400
committerYuriy Taraday <yorik.sar@gmail.com>2011-06-01 18:32:49 +0400
commita26e21040681fd6db5a6ae862ca18ee17689854c (patch)
treedf1fb0c869661b4b428252b5bd5a8ca47123c9d0 /nova
parentf2da479b8988cd55d39e89935b10e0b348df43c9 (diff)
downloadnova-a26e21040681fd6db5a6ae862ca18ee17689854c.tar.gz
nova-a26e21040681fd6db5a6ae862ca18ee17689854c.tar.xz
nova-a26e21040681fd6db5a6ae862ca18ee17689854c.zip
Moved memcached driver import to the top of modules.
Diffstat (limited to 'nova')
-rw-r--r--nova/auth/ldapdriver.py10
-rw-r--r--nova/auth/manager.py10
2 files changed, 12 insertions, 8 deletions
diff --git a/nova/auth/ldapdriver.py b/nova/auth/ldapdriver.py
index 91f412baa..e26a360af 100644
--- a/nova/auth/ldapdriver.py
+++ b/nova/auth/ldapdriver.py
@@ -69,6 +69,12 @@ flags.DEFINE_string('ldap_developer',
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
# to define a set interface for AuthDrivers. I'm delaying
# 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.simple_bind_s(FLAGS.ldap_user_dn, FLAGS.ldap_password)
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)
def __enter__(self):
diff --git a/nova/auth/manager.py b/nova/auth/manager.py
index c887297f3..98c7dd263 100644
--- a/nova/auth/manager.py
+++ b/nova/auth/manager.py
@@ -73,6 +73,12 @@ flags.DEFINE_string('auth_driver', 'nova.auth.dbdriver.DbDriver',
LOG = logging.getLogger('nova.auth.manager')
+if FLAGS.memcached_servers:
+ import memcache
+else:
+ from nova import fakememcache as memcache
+
+
class AuthBase(object):
"""Base class for objects relating to auth
@@ -224,10 +230,6 @@ class AuthManager(object):
if driver or not getattr(self, 'driver', None):
self.driver = utils.import_class(driver or FLAGS.auth_driver)
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)
def authenticate(self, access, signature, params, verb='GET',