From c02e8d8c8060acbb462438b57d4712a243841402 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sun, 28 Sep 2014 12:17:03 -0400 Subject: [PATCH] Don't search powershell modules unless using the winrm connection. --- lib/ansible/modules/core | 2 +- lib/ansible/runner/__init__.py | 2 +- lib/ansible/utils/plugins.py | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/core b/lib/ansible/modules/core index 617a52b20d5..9b35a391213 160000 --- a/lib/ansible/modules/core +++ b/lib/ansible/modules/core @@ -1 +1 @@ -Subproject commit 617a52b20d512a4eb5e88fdc76658b220ff80266 +Subproject commit 9b35a391213fe87834af5ebc907109de2bc0005f diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 014cb6276a9..a76e6863ba4 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -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: diff --git a/lib/ansible/utils/plugins.py b/lib/ansible/utils/plugins.py index 816bf19c695..800802bc156 100644 --- a/lib/ansible/utils/plugins.py +++ b/lib/ansible/utils/plugins.py @@ -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)