Example #1
0
    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)
Example #2
0
    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
Example #3
0
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)
Example #4
0
    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
Example #5
0
    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
Example #6
0
 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
Example #7
0
 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
Example #8
0
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)
Example #9
0
def test_memcached_cachemodule_with_loader():
    assert isinstance(cache_loader.get('community.general.memcached'),
                      MemcachedCache)
Example #10
0
 def test_memory_cachemodule_with_loader(self):
     self.assertIsInstance(cache_loader.get('memory'), MemoryCache)
Example #11
0
def test_memory_cachemodule_with_loader():
    assert isinstance(cache_loader.get('memory'), MemoryCache)
Example #12
0
 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)
Example #13
0
 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
Example #14
0
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)