mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Add shell_plugins to abstract shell-specific functions out of runner, add winrm connection plugin, add initial Windows modules.
This commit is contained in:
parent
627ff30a6f
commit
5dcaa30476
25 changed files with 757 additions and 103 deletions
|
@ -139,21 +139,25 @@ class PluginLoader(object):
|
|||
if directory not in self._extra_dirs:
|
||||
self._extra_dirs.append(directory)
|
||||
|
||||
def find_plugin(self, name):
|
||||
def find_plugin(self, name, suffixes=None):
|
||||
''' Find a plugin named name '''
|
||||
|
||||
if name in self._plugin_path_cache:
|
||||
return self._plugin_path_cache[name]
|
||||
if not suffixes:
|
||||
if self.class_name:
|
||||
suffixes = ['.py']
|
||||
else:
|
||||
suffixes = ['']
|
||||
|
||||
suffix = ".py"
|
||||
if not self.class_name:
|
||||
suffix = ""
|
||||
for suffix in suffixes:
|
||||
full_name = '%s%s' % (name, suffix)
|
||||
if full_name in self._plugin_path_cache:
|
||||
return self._plugin_path_cache[full_name]
|
||||
|
||||
for i in self._get_paths():
|
||||
path = os.path.join(i, "%s%s" % (name, suffix))
|
||||
if os.path.isfile(path):
|
||||
self._plugin_path_cache[name] = path
|
||||
return path
|
||||
for i in self._get_paths():
|
||||
path = os.path.join(i, full_name)
|
||||
if os.path.isfile(path):
|
||||
self._plugin_path_cache[full_name] = path
|
||||
return path
|
||||
|
||||
return None
|
||||
|
||||
|
@ -212,6 +216,13 @@ connection_loader = PluginLoader(
|
|||
aliases={'paramiko': 'paramiko_ssh'}
|
||||
)
|
||||
|
||||
shell_loader = PluginLoader(
|
||||
'ShellModule',
|
||||
'ansible.runner.shell_plugins',
|
||||
'shell_plugins',
|
||||
'shell_plugins',
|
||||
)
|
||||
|
||||
module_finder = PluginLoader(
|
||||
'',
|
||||
'',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue