mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #9293 from cchurch/module_suffixes
Simpler fix for module suffixes than c02e8d8c8
.
This commit is contained in:
commit
346689f9f2
2 changed files with 3 additions and 6 deletions
|
@ -1347,7 +1347,7 @@ class Runner(object):
|
||||||
|
|
||||||
# Search module path(s) for named module.
|
# Search module path(s) for named module.
|
||||||
module_suffixes = getattr(conn, 'default_suffixes', None)
|
module_suffixes = getattr(conn, 'default_suffixes', None)
|
||||||
module_path = utils.plugins.module_finder.find_plugin(module_name, module_suffixes, transport=self.transport)
|
module_path = utils.plugins.module_finder.find_plugin(module_name, module_suffixes)
|
||||||
if module_path is None:
|
if module_path is None:
|
||||||
module_path2 = utils.plugins.module_finder.find_plugin('ping', module_suffixes)
|
module_path2 = utils.plugins.module_finder.find_plugin('ping', module_suffixes)
|
||||||
if module_path2 is not None:
|
if module_path2 is not None:
|
||||||
|
|
|
@ -156,17 +156,14 @@ class PluginLoader(object):
|
||||||
self._extra_dirs.append(directory)
|
self._extra_dirs.append(directory)
|
||||||
self._paths = None
|
self._paths = None
|
||||||
|
|
||||||
def find_plugin(self, name, suffixes=None, transport=''):
|
def find_plugin(self, name, suffixes=None):
|
||||||
''' Find a plugin named name '''
|
''' Find a plugin named name '''
|
||||||
|
|
||||||
if not suffixes:
|
if not suffixes:
|
||||||
if self.class_name:
|
if self.class_name:
|
||||||
suffixes = ['.py']
|
suffixes = ['.py']
|
||||||
else:
|
else:
|
||||||
if transport == 'winrm':
|
suffixes = ['.py', '']
|
||||||
suffixes = ['.ps1', '']
|
|
||||||
else:
|
|
||||||
suffixes = ['.py', '']
|
|
||||||
|
|
||||||
potential_names = frozenset('%s%s' % (name, s) for s in suffixes)
|
potential_names = frozenset('%s%s' % (name, s) for s in suffixes)
|
||||||
for full_name in potential_names:
|
for full_name in potential_names:
|
||||||
|
|
Loading…
Reference in a new issue