summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Coca <brian.coca+git@gmail.com>2014-12-01 17:36:57 -0500
committerJames Cammarata <jimi@sngx.net>2014-12-04 16:07:32 -0600
commitecdeed43420efac0aa7afa65fe9148c774e1009a (patch)
tree95e7ad98682c0199b2244d1425a999ca95358aee
parente81a6da49b4bc142b4ec9a5d2c4e43d1a34aa408 (diff)
downloadansible-ecdeed43420efac0aa7afa65fe9148c774e1009a.tar.gz
changed plugin load priority to be path based, not suffix based.
-rw-r--r--lib/ansible/utils/plugins.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/ansible/utils/plugins.py b/lib/ansible/utils/plugins.py
index 1955ade237..29771d0ed9 100644
--- a/lib/ansible/utils/plugins.py
+++ b/lib/ansible/utils/plugins.py
@@ -167,17 +167,20 @@ class PluginLoader(object):
else:
suffixes = ['.py', '']
- for suffix in suffixes:
- full_name = '%s%s' % (name, suffix)
- if full_name in self._plugin_path_cache:
- return self._plugin_path_cache[full_name]
+ # loop over paths and then loop over suffixes to find plugin
+ for i in self._get_paths():
+ for suffix in suffixes:
+ full_name = '%s%s' % (name, suffix)
+
+ if full_name in self._plugin_path_cache:
+ return self._plugin_path_cache[full_name]
- for i in self._get_paths():
path = os.path.join(i, full_name)
if os.path.isfile(path):
self._plugin_path_cache[full_name] = path
return path
+ # if nothing is found, try finding alias/deprecated
if not name.startswith('_'):
return self.find_plugin('_' + name, suffixes, transport)