From c346788194770c636c50af462b26000e81fc59c4 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Thu, 11 Jun 2015 08:54:25 -0700 Subject: [PATCH] Slight optimization of how we squash loops. Add dnf to the list of modules for which we squash. Fixes #11235 --- lib/ansible/executor/task_executor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index 8de8f7027a..ddd557f999 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -48,6 +48,10 @@ class TaskExecutor: 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): self._host = host self._task = task @@ -176,7 +180,7 @@ class TaskExecutor: (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 = [] for item in items: variables['item'] = item