mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix the error handling for loop squashing to restore the name argument into the task args
This commit is contained in:
parent
a0ff49194e
commit
b75895df9b
1 changed files with 5 additions and 1 deletions
|
@ -269,6 +269,7 @@ class TaskExecutor:
|
|||
Squash items down to a comma-separated list for certain modules which support it
|
||||
(typically package management modules).
|
||||
'''
|
||||
name = None
|
||||
try:
|
||||
# _task.action could contain templatable strings (via action: and
|
||||
# local_action:) Template it before comparing. If we don't end up
|
||||
|
@ -284,7 +285,6 @@ class TaskExecutor:
|
|||
if all(isinstance(o, string_types) for o in items):
|
||||
final_items = []
|
||||
|
||||
name = None
|
||||
for allowed in ['name', 'pkg', 'package']:
|
||||
name = self._task.args.pop(allowed, None)
|
||||
if name is not None:
|
||||
|
@ -326,6 +326,10 @@ class TaskExecutor:
|
|||
except:
|
||||
# Squashing is an optimization. If it fails for any reason,
|
||||
# simply use the unoptimized list of items.
|
||||
|
||||
# Restore the name parameter
|
||||
if name is not None:
|
||||
self._task.args['name'] = name
|
||||
pass
|
||||
return items
|
||||
|
||||
|
|
Loading…
Reference in a new issue