Add the task info for tombstoned module/action plugins (#82451)

* Add the task info for tombstoned plugins

* Fix deprecation for 'include' by removing it from BUILTIN_TASKS which skip the plugin loader lookup

* changelog

remove obsolete unit test using 'include'

* Update changelogs/fragments/improve-tombstone-error.yml
pull/80625/merge
Sloane Hertel 4 months ago committed by GitHub
parent b5649f9686
commit caa86cc4df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,3 @@
bugfixes:
- Include the task location when a module or action plugin is deprecated (https://github.com/ansible/ansible/issues/82450).
- Give the tombstone error for ``include`` pre-fork like other tombstoned action/module plugins.

@ -46,7 +46,6 @@ RAW_PARAM_MODULES = FREEFORM_ACTIONS.union(add_internal_fqcns((
BUILTIN_TASKS = frozenset(add_internal_fqcns((
'meta',
'include',
'include_tasks',
'include_role',
'import_tasks',
@ -302,9 +301,14 @@ class ModuleArgsParser:
elif skip_action_validation:
is_action_candidate = True
else:
context = action_loader.find_plugin_with_context(item, collection_list=self._collection_list)
if not context.resolved:
context = module_loader.find_plugin_with_context(item, collection_list=self._collection_list)
try:
context = action_loader.find_plugin_with_context(item, collection_list=self._collection_list)
if not context.resolved:
context = module_loader.find_plugin_with_context(item, collection_list=self._collection_list)
except AnsibleError as e:
if e.obj is None:
e.obj = self._task_ds
raise e
is_action_candidate = context.resolved and bool(context.redirect_list)

@ -151,3 +151,12 @@ fi
./vars_plugin_tests.sh
./test_task_resolved_plugin.sh
# Test tombstoned module/action plugins include the location of the fatal task
cat <<EOF > test_dead_ping_error.yml
- hosts: localhost
gather_facts: no
tasks:
- dead_ping:
EOF
ansible-playbook test_dead_ping_error.yml 2>&1 >/dev/null | grep -e 'line 4, column 5'

@ -315,9 +315,6 @@ def test_empty_raw_params():
parent_task._play = None
task_ds_list = [
{
'include': ''
},
{
'include_tasks': ''
},

Loading…
Cancel
Save