lazy loading of oslo_cache

Now, we depend on oslo.cache [1], and use the private/internal
memcache_pool code of the lib, making oslo.cache failing to import
instead of just log an error about missing requirement for selected
drivers at runtime.

This change restores the previous behavior by lazy loading the module.

[1] 9d8e2836fe

Change-Id: I00e953abb3e835a94353fe458100c96e8e9c095a
Closes-bug: #1737115
This commit is contained in:
Mehdi Abaakouk 2017-12-12 18:22:00 +01:00
parent db21ecd2b5
commit 35fa0e1da1
1 changed files with 3 additions and 3 deletions

View File

@ -13,7 +13,6 @@
import contextlib
import hashlib
from oslo_cache import _memcache_pool as memcache_pool
from oslo_serialization import jsonutils
from oslo_utils import timeutils
import six
@ -90,8 +89,9 @@ class _MemcacheClientPool(object):
"""An advanced memcached client pool that is eventlet safe."""
def __init__(self, memcache_servers, **kwargs):
self._pool = memcache_pool.MemcacheClientPool(memcache_servers,
**kwargs)
from oslo_cache import _memcache_pool
self._pool = _memcache_pool.MemcacheClientPool(memcache_servers,
**kwargs)
@contextlib.contextmanager
def reserve(self):