mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 21:31:26 -07:00
minimize loading files/plugins
avoids some repetitive loading - read config file only once - now cache the ini parser per file - optimize shell plugin loading tried to 'optimize' vars_plugins loading but it creates issues with precedence, probalby due to iterator not being reset, will look into it in subsequent fix/PR
This commit is contained in:
parent
34c002c771
commit
42912e1ac8
3 changed files with 20 additions and 11 deletions
|
@ -91,10 +91,15 @@ class ConnectionBase(AnsiblePlugin):
|
|||
else:
|
||||
shell_type = 'sh'
|
||||
shell_filename = os.path.basename(self._play_context.executable)
|
||||
for shell in shell_loader.all():
|
||||
if shell_filename in shell.COMPATIBLE_SHELLS:
|
||||
shell_type = shell.SHELL_FAMILY
|
||||
break
|
||||
try:
|
||||
shell = shell_loader.get(shell_filename)
|
||||
except Exception:
|
||||
shell = None
|
||||
if shell is None:
|
||||
for shell in shell_loader.all():
|
||||
if shell_filename in shell.COMPATIBLE_SHELLS:
|
||||
break
|
||||
shell_type = shell.SHELL_FAMILY
|
||||
|
||||
self._shell = shell_loader.get(shell_type)
|
||||
if not self._shell:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue