mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Deprecate squash_actions (#35978)
* Deprecate squash_actions * Wording update * Update wording and version * Update versions to reflect 2.7 deprecation * Add 2.7 porting guide
This commit is contained in:
parent
4d77878654
commit
96ec32630e
3 changed files with 101 additions and 0 deletions
|
@ -377,9 +377,11 @@ class TaskExecutor:
|
|||
if all(isinstance(o, string_types) for o in items):
|
||||
final_items = []
|
||||
|
||||
found = None
|
||||
for allowed in ['name', 'pkg', 'package']:
|
||||
name = self._task.args.pop(allowed, None)
|
||||
if name is not None:
|
||||
found = allowed
|
||||
break
|
||||
|
||||
# This gets the information to check whether the name field
|
||||
|
@ -397,6 +399,12 @@ class TaskExecutor:
|
|||
# name/pkg or the name/pkg field doesn't have any variables
|
||||
# and thus the items can't be squashed
|
||||
if template_no_item != template_with_item:
|
||||
display.deprecated(
|
||||
'Invoking "%s" only once while using a loop via squash_actions is deprecated. '
|
||||
'Instead of using a loop to supply multiple items and specifying `%s: %s`, '
|
||||
'please use `%s: %r` and remove the loop' % (self._task.action, found, name, found, self._task.loop),
|
||||
version='2.11'
|
||||
)
|
||||
for item in items:
|
||||
variables[loop_var] = item
|
||||
if self._task.evaluate_conditional(templar, variables):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue