mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #13114 from mgedmin/fix-plugin-loader
Check sys.modules before loading modules
This commit is contained in:
commit
9f0c2cfda5
1 changed files with 3 additions and 0 deletions
|
@ -304,6 +304,9 @@ class PluginLoader:
|
||||||
__contains__ = has_plugin
|
__contains__ = has_plugin
|
||||||
|
|
||||||
def _load_module_source(self, name, path):
|
def _load_module_source(self, name, path):
|
||||||
|
if name in sys.modules:
|
||||||
|
# See https://github.com/ansible/ansible/issues/13110
|
||||||
|
return sys.modules[name]
|
||||||
with open(path, 'r') as module_file:
|
with open(path, 'r') as module_file:
|
||||||
module = imp.load_source(name, path, module_file)
|
module = imp.load_source(name, path, module_file)
|
||||||
return module
|
return module
|
||||||
|
|
Loading…
Reference in a new issue