Removed deprecated handle_stats_and_callbacks param of _load_included_file (#86063)

* Removed deprecated handle_stats_and_callbacks param of _load_included_file

Fixes #86003

* ci_complete
This commit is contained in:
Martin Krizek
2025-11-05 19:25:49 +01:00
committed by GitHub
parent 388ce79fcd
commit a2dda41bb6
5 changed files with 3 additions and 26 deletions

View File

@@ -0,0 +1,2 @@
removed_features:
- Removed deprecated ``handle_stats_and_callbacks`` parameter of the ``StrategyBase._load_included_file`` method. (https://github.com/ansible/ansible/issues/86003)

View File

@@ -815,7 +815,7 @@ class StrategyBase:
return ti_copy
def _load_included_file(self, included_file: IncludedFile, iterator, is_handler=False, handle_stats_and_callbacks=True):
def _load_included_file(self, included_file: IncludedFile, iterator, is_handler=False):
"""
Loads an included YAML file of tasks, applying the optional set of variables.
@@ -823,15 +823,6 @@ class StrategyBase:
in such case the caller is responsible for marking the host(s) as failed
using PlayIterator.mark_host_failed().
"""
if handle_stats_and_callbacks:
display.deprecated(
msg="Reporting play recap stats and running callbacks functionality for "
"``include_tasks`` in ``StrategyBase._load_included_file`` is deprecated. "
"See ``https://github.com/ansible/ansible/pull/79260`` for guidance on how to "
"move the reporting into specific strategy plugins to account for "
"``include_role`` tasks as well.",
version="2.21",
)
display.debug("loading included file: %s" % included_file._filename)
try:
data = self._loader.load_from_file(included_file._filename, trusted_as_template=True)
@@ -851,9 +842,6 @@ class StrategyBase:
loader=self._loader,
variable_manager=self._variable_manager,
)
if handle_stats_and_callbacks:
for host in included_file._hosts:
self._tqm._stats.increment('ok', host.name)
except AnsibleParserError:
raise
except AnsibleError as e:
@@ -861,18 +849,8 @@ class StrategyBase:
reason = "Could not find or access '%s' on the Ansible Controller." % to_text(e.file_name)
else:
reason = to_text(e)
if handle_stats_and_callbacks:
for tr in included_file._results:
tr._return_data['failed'] = True
for host in included_file._hosts:
tr = _RawTaskResult(host=host, task=included_file._task, return_data=dict(failed=True, reason=reason), task_fields={})
self._tqm._stats.increment('failures', host.name)
self._tqm.send_callback('v2_runner_on_failed', tr)
raise AnsibleError(reason) from e
if handle_stats_and_callbacks:
self._tqm.send_callback('v2_playbook_on_include', included_file)
display.debug("done processing included file")
return block_list

View File

@@ -240,7 +240,6 @@ class StrategyModule(StrategyBase):
included_file,
iterator=iterator,
is_handler=is_handler,
handle_stats_and_callbacks=False,
)
# let PlayIterator know about any new handlers included via include_role or

View File

@@ -250,7 +250,6 @@ class StrategyModule(StrategyBase):
included_file,
iterator=iterator,
is_handler=is_handler,
handle_stats_and_callbacks=False,
)
# let PlayIterator know about any new handlers included via include_role or

View File

@@ -230,5 +230,4 @@ test/integration/targets/ansible-test-sanity-pylint/deprecated_thing.py pylint:a
test/integration/targets/ansible-test-sanity-pylint/deprecated_thing.py pylint:ansible-deprecated-collection-name-not-permitted # required to verify plugin against core
lib/ansible/module_utils/compat/paramiko.py pylint:ansible-deprecated-version # TODO: 2.21
lib/ansible/plugins/connection/paramiko_ssh.py pylint:ansible-deprecated-version # TODO: 2.21
lib/ansible/plugins/strategy/__init__.py pylint:ansible-deprecated-version # TODO: 2.21
.github/RELEASE_NAMES.txt release-names # TODO: 2.21