summaryrefslogtreecommitdiff
path: root/lib/ansible/plugins/__init__.py
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2015-11-19 09:39:37 -0800
committerToshio Kuratomi <toshio@fedoraproject.org>2015-11-19 09:39:37 -0800
commitc86120cea60049ae5c0dc5213cf1ace62515bf58 (patch)
tree22b5e742b3b775e285fa4c6540cb3f3ec58f5c7c /lib/ansible/plugins/__init__.py
parentc97c101bd3369e29ed3f789d8e8a109b75d9caca (diff)
downloadansible-c86120cea60049ae5c0dc5213cf1ace62515bf58.tar.gz
Fix non-module plugins picking up files that did not end in .py.more-strict-plugin-lookup
This was caused by accessing the cache using the passed in mod_type rather than the suffix that we calculate with knowledge of whether this is a module or non-module plugin.
Diffstat (limited to 'lib/ansible/plugins/__init__.py')
-rw-r--r--lib/ansible/plugins/__init__.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/ansible/plugins/__init__.py b/lib/ansible/plugins/__init__.py
index 87de300e3c..139e5a7d61 100644
--- a/lib/ansible/plugins/__init__.py
+++ b/lib/ansible/plugins/__init__.py
@@ -213,15 +213,6 @@ class PluginLoader:
def find_plugin(self, name, mod_type=''):
''' Find a plugin named name '''
- # The particular cache to look for modules within. This matches the
- # requested mod_type
- pull_cache = self._plugin_path_cache[mod_type]
- try:
- return pull_cache[name]
- except KeyError:
- # Cache miss. Now let's find the plugin
- pass
-
if mod_type:
suffix = mod_type
elif self.class_name:
@@ -232,6 +223,15 @@ class PluginLoader:
# they can have any suffix
suffix = ''
+ # The particular cache to look for modules within. This matches the
+ # requested mod_type
+ pull_cache = self._plugin_path_cache[suffix]
+ try:
+ return pull_cache[name]
+ except KeyError:
+ # Cache miss. Now let's find the plugin
+ pass
+
# TODO: Instead of using the self._paths cache (PATH_CACHE) and
# self._searched_paths we could use an iterator. Before enabling that
# we need to make sure we don't want to add additional directories