mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-26 08:26:28 +00:00
Don't search powershell modules unless using the winrm connection.
This commit is contained in:
Submodule lib/ansible/modules/core updated: 617a52b20d...9b35a39121
@@ -1213,7 +1213,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)
|
module_path = utils.plugins.module_finder.find_plugin(module_name, module_suffixes, transport=self.transport)
|
||||||
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:
|
||||||
|
|||||||
@@ -159,14 +159,17 @@ class PluginLoader(object):
|
|||||||
if directory not in self._extra_dirs:
|
if directory not in self._extra_dirs:
|
||||||
self._extra_dirs.append(directory)
|
self._extra_dirs.append(directory)
|
||||||
|
|
||||||
def find_plugin(self, name, suffixes=None):
|
def find_plugin(self, name, suffixes=None, transport=''):
|
||||||
''' 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:
|
||||||
suffixes = ['', '.ps1', '.py']
|
if transport == 'winrm':
|
||||||
|
suffixes = ['.ps1', '']
|
||||||
|
else:
|
||||||
|
suffixes = ['.py', '']
|
||||||
|
|
||||||
for suffix in suffixes:
|
for suffix in suffixes:
|
||||||
full_name = '%s%s' % (name, suffix)
|
full_name = '%s%s' % (name, suffix)
|
||||||
|
|||||||
Reference in New Issue
Block a user