def __init__(self, *args, **kwargs): self._plugin = cache_loader.get(C.CACHE_PLUGIN) if not self._plugin: raise AnsibleError('Unable to load the facts cache plugin (%s).' % (C.CACHE_PLUGIN)) super(FactCache, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): self._plugin = cache_loader.get(C.CACHE_PLUGIN) if not self._plugin: raise AnsibleError('Unable to load the facts cache plugin (%s).' % (C.CACHE_PLUGIN)) # Backwards compat: self._display isn't really needed, just import the global display and use that. self._display = display
def test_redis_cachemodule(): # The _uri option is required for the redis plugin connection = '[::1]:6379:1' if ansible_version.startswith('2.9.'): C.CACHE_PLUGIN_CONNECTION = connection assert isinstance( cache_loader.get('community.general.redis', **{'_uri': connection}), RedisCache)
def __init__(self, plugin_name='memory', **kwargs): self._cache = {} self._retrieved = {} self._plugin = cache_loader.get(plugin_name, **kwargs) if not self._plugin: raise AnsibleError('Unable to load the cache plugin (%s).' % plugin_name) self._plugin_name = plugin_name
def __init__(self, *args, **kwargs): self._plugin = cache_loader.get(C.CACHE_PLUGIN) if not self._plugin: raise AnsibleError('Unable to load the facts cache plugin (%s).' % (C.CACHE_PLUGIN)) # Backwards compat: self._display isn't really needed, just import the global display and use that. self._display = display
def get_plugin(self, plugin_name): plugin = cache_loader.get(plugin_name, cache_connection=self._cache_dir, cache_timeout=self._timeout) if not plugin: raise AnsibleError('Unable to load the facts cache plugin (%s).' % (plugin_name)) self._cache = {} return plugin
def get_cache(self): if not self._cache: # TO-DO: support jsonfile or other modes of caching with # a configurable option self._cache = cache_loader.get("ansible.netcommon.memory") return self._cache
def test_redis_cachemodule(): # The _uri option is required for the redis plugin connection = '[::1]:6379:1' assert isinstance(cache_loader.get('community.general.redis', **{'_uri': connection}), RedisCache)
def test_memcached_cachemodule_with_loader(): assert isinstance(cache_loader.get('community.general.memcached'), MemcachedCache)
def test_memory_cachemodule_with_loader(self): self.assertIsInstance(cache_loader.get('memory'), MemoryCache)
def test_memory_cachemodule_with_loader(): assert isinstance(cache_loader.get('memory'), MemoryCache)
def test_redis_cachemodule_with_loader(self): # The _uri option is required for the redis plugin self.assertIsInstance( cache_loader.get('redis', **{'_uri': '127.0.0.1:6379:1'}), RedisCache)
def get_plugin(self, plugin_name): plugin = cache_loader.get(plugin_name, cache_connection=self._cache_dir, cache_timeout=self._timeout) if not plugin: raise AnsibleError('Unable to load the facts cache plugin (%s).' % (plugin_name)) self._cache = {} return plugin
def test_redis_cachemodule(): # The _uri option is required for the redis plugin assert isinstance(cache_loader.get('community.general.redis', **{'_uri': '127.0.0.1:6379:1'}), RedisCache)