mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00: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:
@@ -970,6 +970,10 @@ DEFAULT_SQUASH_ACTIONS:
|
||||
- {key: squash_actions, section: defaults}
|
||||
type: list
|
||||
version_added: "2.0"
|
||||
deprecated:
|
||||
why: Loop squashing is deprecated and this configuration will no longer be used
|
||||
version: "2.11"
|
||||
alternatives: a list directly with the module argument
|
||||
DEFAULT_SSH_TRANSFER_METHOD:
|
||||
# TODO: move to ssh plugin
|
||||
default:
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user