mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 14:41:23 -07:00
Slight optimization of how we squash loops. Add dnf to the list of modules for which we squash.
Fixes #11235
This commit is contained in:
parent
aed429554d
commit
c346788194
1 changed files with 5 additions and 1 deletions
|
@ -48,6 +48,10 @@ class TaskExecutor:
|
||||||
class.
|
class.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
# Modules that we optimize by squashing loop items into a single call to
|
||||||
|
# the module
|
||||||
|
SQUASH_ACTIONS = frozenset(('apt', 'yum', 'pkgng', 'zypper', 'dnf'))
|
||||||
|
|
||||||
def __init__(self, host, task, job_vars, connection_info, new_stdin, loader, shared_loader_obj):
|
def __init__(self, host, task, job_vars, connection_info, new_stdin, loader, shared_loader_obj):
|
||||||
self._host = host
|
self._host = host
|
||||||
self._task = task
|
self._task = task
|
||||||
|
@ -176,7 +180,7 @@ class TaskExecutor:
|
||||||
(typically package management modules).
|
(typically package management modules).
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if len(items) > 0 and self._task.action in ('apt', 'yum', 'pkgng', 'zypper'):
|
if len(items) > 0 and self._task.action in self.SQUASH_ACTIONS:
|
||||||
final_items = []
|
final_items = []
|
||||||
for item in items:
|
for item in items:
|
||||||
variables['item'] = item
|
variables['item'] = item
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue