mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 03:11:24 -07:00
Don't cache duplicate plugin names (#34420)
* Don't cache duplicate plugin names. Fixes #33484 * Add tests for duplicate plugin filenames, to showcase what happens
This commit is contained in:
parent
edf56c9743
commit
aece0818c4
4 changed files with 61 additions and 1 deletions
|
@ -424,7 +424,14 @@ class PluginLoader:
|
|||
continue
|
||||
|
||||
if path not in self._module_cache:
|
||||
self._module_cache[path] = self._load_module_source(name, path)
|
||||
module = self._load_module_source(name, path)
|
||||
if module in self._module_cache.values():
|
||||
# In ``_load_module_source`` if a plugin has a duplicate name, we just return the
|
||||
# previously matched plugin from sys.modules, which means you are never getting both,
|
||||
# just one, but cached for both paths, this isn't normally a problem, except with callbacks
|
||||
# where it will run that single callback twice. This rejects duplicates.
|
||||
continue
|
||||
self._module_cache[path] = module
|
||||
found_in_cache = False
|
||||
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue