Merge pull request #13217 from ansible/more-strict-plugin-lookup

Fix non-module plugins picking up files that did not end in .py.
pull/13248/head
Toshio Kuratomi 9 years ago
commit 8fd15ae2a3

@ -213,15 +213,6 @@ class PluginLoader:
def find_plugin(self, name, mod_type=''): def find_plugin(self, name, mod_type=''):
''' Find a plugin named name ''' ''' 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: if mod_type:
suffix = mod_type suffix = mod_type
elif self.class_name: elif self.class_name:
@ -232,6 +223,15 @@ class PluginLoader:
# they can have any suffix # they can have any suffix
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 # TODO: Instead of using the self._paths cache (PATH_CACHE) and
# self._searched_paths we could use an iterator. Before enabling that # self._searched_paths we could use an iterator. Before enabling that
# we need to make sure we don't want to add additional directories # we need to make sure we don't want to add additional directories

Loading…
Cancel
Save