mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
WIP on the re-implementation of fact caching and various backends.
This commit is contained in:
parent
fb5a1403dd
commit
aa419044c4
11 changed files with 466 additions and 48 deletions
|
@ -108,14 +108,14 @@ class PluginLoader(object):
|
|||
if fullpath not in ret:
|
||||
ret.append(fullpath)
|
||||
|
||||
# look in any configured plugin paths, allow one level deep for subcategories
|
||||
# look in any configured plugin paths, allow one level deep for subcategories
|
||||
configured_paths = self.config.split(os.pathsep)
|
||||
for path in configured_paths:
|
||||
path = os.path.realpath(os.path.expanduser(path))
|
||||
contents = glob.glob("%s/*" % path)
|
||||
for c in contents:
|
||||
if os.path.isdir(c) and c not in ret:
|
||||
ret.append(c)
|
||||
ret.append(c)
|
||||
if path not in ret:
|
||||
ret.append(path)
|
||||
|
||||
|
@ -181,7 +181,7 @@ class PluginLoader(object):
|
|||
return getattr(self._module_cache[path], self.class_name)(*args, **kwargs)
|
||||
|
||||
def all(self, *args, **kwargs):
|
||||
''' instantiates all plugins with the same arguments '''
|
||||
''' instantiates all plugins with the same arguments '''
|
||||
|
||||
for i in self._get_paths():
|
||||
matches = glob.glob(os.path.join(i, "*.py"))
|
||||
|
@ -195,24 +195,31 @@ class PluginLoader(object):
|
|||
yield getattr(self._module_cache[path], self.class_name)(*args, **kwargs)
|
||||
|
||||
action_loader = PluginLoader(
|
||||
'ActionModule',
|
||||
'ActionModule',
|
||||
'ansible.runner.action_plugins',
|
||||
C.DEFAULT_ACTION_PLUGIN_PATH,
|
||||
'action_plugins'
|
||||
)
|
||||
|
||||
cache_loader = PluginLoader(
|
||||
'CacheModule',
|
||||
'ansible.cache',
|
||||
C.DEFAULT_CACHE_PLUGIN_PATH,
|
||||
'cache_plugins'
|
||||
)
|
||||
|
||||
callback_loader = PluginLoader(
|
||||
'CallbackModule',
|
||||
'ansible.callback_plugins',
|
||||
C.DEFAULT_CALLBACK_PLUGIN_PATH,
|
||||
'CallbackModule',
|
||||
'ansible.callback_plugins',
|
||||
C.DEFAULT_CALLBACK_PLUGIN_PATH,
|
||||
'callback_plugins'
|
||||
)
|
||||
|
||||
connection_loader = PluginLoader(
|
||||
'Connection',
|
||||
'ansible.runner.connection_plugins',
|
||||
C.DEFAULT_CONNECTION_PLUGIN_PATH,
|
||||
'connection_plugins',
|
||||
'Connection',
|
||||
'ansible.runner.connection_plugins',
|
||||
C.DEFAULT_CONNECTION_PLUGIN_PATH,
|
||||
'connection_plugins',
|
||||
aliases={'paramiko': 'paramiko_ssh'}
|
||||
)
|
||||
|
||||
|
@ -224,30 +231,30 @@ shell_loader = PluginLoader(
|
|||
)
|
||||
|
||||
module_finder = PluginLoader(
|
||||
'',
|
||||
'',
|
||||
C.DEFAULT_MODULE_PATH,
|
||||
'',
|
||||
'',
|
||||
C.DEFAULT_MODULE_PATH,
|
||||
'library'
|
||||
)
|
||||
|
||||
lookup_loader = PluginLoader(
|
||||
'LookupModule',
|
||||
'ansible.runner.lookup_plugins',
|
||||
C.DEFAULT_LOOKUP_PLUGIN_PATH,
|
||||
'LookupModule',
|
||||
'ansible.runner.lookup_plugins',
|
||||
C.DEFAULT_LOOKUP_PLUGIN_PATH,
|
||||
'lookup_plugins'
|
||||
)
|
||||
|
||||
vars_loader = PluginLoader(
|
||||
'VarsModule',
|
||||
'ansible.inventory.vars_plugins',
|
||||
C.DEFAULT_VARS_PLUGIN_PATH,
|
||||
'VarsModule',
|
||||
'ansible.inventory.vars_plugins',
|
||||
C.DEFAULT_VARS_PLUGIN_PATH,
|
||||
'vars_plugins'
|
||||
)
|
||||
|
||||
filter_loader = PluginLoader(
|
||||
'FilterModule',
|
||||
'ansible.runner.filter_plugins',
|
||||
C.DEFAULT_FILTER_PLUGIN_PATH,
|
||||
'FilterModule',
|
||||
'ansible.runner.filter_plugins',
|
||||
C.DEFAULT_FILTER_PLUGIN_PATH,
|
||||
'filter_plugins'
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue