Fix the linode inventory plugin, and the redis and memcached cache plugins (#1281, #1282, #1283).

This commit is contained in:
Felix Fontein 2020-11-13 21:34:56 +01:00 committed by David Moreau Simard
parent 07fa7ea409
commit 75fd32ca55
4 changed files with 19 additions and 3 deletions

View file

@ -57,8 +57,9 @@ from ansible.utils.display import Display
try:
import memcache
HAS_MEMCACHE = True
except ImportError:
raise AnsibleError("python-memcached is required for the memcached fact cache")
HAS_MEMCACHE = False
display = Display()
@ -187,6 +188,9 @@ class CacheModule(BaseCacheModule):
self._timeout = C.CACHE_PLUGIN_TIMEOUT
self._prefix = C.CACHE_PLUGIN_PREFIX
if not HAS_MEMCACHE:
raise AnsibleError("python-memcached is required for the memcached fact cache")
self._cache = {}
self._db = ProxyClientPool(connection, debug=0)
self._keys = CacheModuleKeys(self._db, self._db.get(CacheModuleKeys.PREFIX) or [])