mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix for traceback when neither name nor pkg are in the module params
This commit is contained in:
parent
b2a9111b22
commit
e45ce871a7
1 changed files with 13 additions and 10 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue