Don't search powershell modules unless using the winrm connection.

This commit is contained in:
Michael DeHaan 2014-09-28 12:17:03 -04:00
parent 3908d50b03
commit c02e8d8c80
3 changed files with 7 additions and 4 deletions

@ -1 +1 @@
Subproject commit 617a52b20d512a4eb5e88fdc76658b220ff80266
Subproject commit 9b35a391213fe87834af5ebc907109de2bc0005f

View file

@ -1213,7 +1213,7 @@ class Runner(object):
# Search module path(s) for named module.
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:
module_path2 = utils.plugins.module_finder.find_plugin('ping', module_suffixes)
if module_path2 is not None:

View file

@ -159,14 +159,17 @@ class PluginLoader(object):
if directory not in self._extra_dirs:
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 '''
if not suffixes:
if self.class_name:
suffixes = ['.py']
else:
suffixes = ['', '.ps1', '.py']
if transport == 'winrm':
suffixes = ['.ps1', '']
else:
suffixes = ['.py', '']
for suffix in suffixes:
full_name = '%s%s' % (name, suffix)