summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2015-11-11 16:32:21 +0100
committerToshio Kuratomi <toshio@fedoraproject.org>2015-11-11 16:32:21 +0100
commite45ce871a77462e85131d5e3a99fcd45d32a955b (patch)
treef31d877764341363a4dc00d12ad60c5faee0ed09 /lib
parentreversed the logic on new setting to control - replacment in groups as (diff)
downloadansible-e45ce871a77462e85131d5e3a99fcd45d32a955b.tar.xz
ansible-e45ce871a77462e85131d5e3a99fcd45d32a955b.zip
Fix for traceback when neither name nor pkg are in the module params
Diffstat (limited to 'lib')
-rw-r--r--lib/ansible/executor/task_executor.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py
index 36c1538141..10d2113fc9 100644
--- a/lib/ansible/executor/task_executor.py
+++ b/lib/ansible/executor/task_executor.py
@@ -252,16 +252,19 @@ class TaskExecutor:
if all(isinstance(o, string_types) for o in items):
final_items = []
name = self._task.args.pop('name', None) or self._task.args.pop('pkg', None)
- for item in items:
- variables['item'] = item
- if self._task.evaluate_conditional(templar, variables):
- if templar._contains_vars(name):
- new_item = templar.template(name, cache=False)
- final_items.append(new_item)
- else:
- final_items.append(item)
- self._task.args['name'] = final_items
- return [final_items]
+ # The user is doing an upgrade or some other operation
+ # that doesn't take name or pkg.
+ if name:
+ for item in items:
+ variables['item'] = item
+ if self._task.evaluate_conditional(templar, variables):
+ if templar._contains_vars(name):
+ new_item = templar.template(name, cache=False)
+ final_items.append(new_item)
+ else:
+ final_items.append(item)
+ self._task.args['name'] = final_items
+ return [final_items]
#elif:
# Right now we only optimize single entries. In the future we
# could optimize more types: