diff options
author | Toshio Kuratomi <toshio@fedoraproject.org> | 2015-11-11 16:32:21 +0100 |
---|---|---|
committer | Toshio Kuratomi <toshio@fedoraproject.org> | 2015-11-11 16:32:21 +0100 |
commit | e45ce871a77462e85131d5e3a99fcd45d32a955b (patch) | |
tree | f31d877764341363a4dc00d12ad60c5faee0ed09 /lib | |
parent | reversed the logic on new setting to control - replacment in groups as (diff) | |
download | ansible-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.py | 23 |
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: |