mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-27 04:41:26 -07:00
minor change to not search in non-existing paths
This commit is contained in:
parent
adc0e8be97
commit
730c2ba403
1 changed files with 13 additions and 12 deletions
|
@ -175,18 +175,19 @@ class PluginLoader(object):
|
||||||
|
|
||||||
found = None
|
found = None
|
||||||
for path in [p for p in self._get_paths() if p not in self._searched_paths]:
|
for path in [p for p in self._get_paths() if p not in self._searched_paths]:
|
||||||
for potential_file in os.listdir(path):
|
if os.path.isdir(path):
|
||||||
for suffix in suffixes:
|
for potential_file in os.listdir(path):
|
||||||
if potential_file.endswith(suffix):
|
for suffix in suffixes:
|
||||||
full_path = os.path.join(path, potential_file)
|
if potential_file.endswith(suffix):
|
||||||
full_name = os.path.basename(full_path)
|
full_path = os.path.join(path, potential_file)
|
||||||
break
|
full_name = os.path.basename(full_path)
|
||||||
else: # Yes, this is a for-else: http://bit.ly/1ElPkyg
|
break
|
||||||
continue
|
else: # Yes, this is a for-else: http://bit.ly/1ElPkyg
|
||||||
|
continue
|
||||||
if full_name not in self._plugin_path_cache:
|
|
||||||
self._plugin_path_cache[full_name] = full_path
|
if full_name not in self._plugin_path_cache:
|
||||||
|
self._plugin_path_cache[full_name] = full_path
|
||||||
|
|
||||||
self._searched_paths.add(path)
|
self._searched_paths.add(path)
|
||||||
for full_name in potential_names:
|
for full_name in potential_names:
|
||||||
if full_name in self._plugin_path_cache:
|
if full_name in self._plugin_path_cache:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue