summaryrefslogtreecommitdiff
path: root/lib/ansible/executor/module_common.py
diff options
context:
space:
mode:
authorSloane Hertel <19572925+s-hertel@users.noreply.github.com>2021-05-27 19:06:45 -0400
committerGitHub <noreply@github.com>2021-05-27 19:06:45 -0400
commit5640093f1ca63fd6af231cc8a7fb7d40e1907b8c (patch)
treeacc0d13194185c344ff910eaadf550ed070818ef /lib/ansible/executor/module_common.py
parenta5a13246ce02fd4c4ce997627b4f42152e59d288 (diff)
downloadansible-5640093f1ca63fd6af231cc8a7fb7d40e1907b8c.tar.gz
Use the module redirect_list when getting defaults for action plugins (#73864)
* Fix module-specific defaults in the gather_facts, package, and service action plugins. * Handle ansible.legacy actions better in get_action_args_with_defaults * Add tests for each action plugin * Changelog Fixes #72918
Diffstat (limited to 'lib/ansible/executor/module_common.py')
-rw-r--r--lib/ansible/executor/module_common.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/ansible/executor/module_common.py b/lib/ansible/executor/module_common.py
index 81cce0cc75..5871c66d45 100644
--- a/lib/ansible/executor/module_common.py
+++ b/lib/ansible/executor/module_common.py
@@ -1418,9 +1418,14 @@ def get_action_args_with_defaults(action, args, defaults, templar, redirected_na
tmp_args.update((module_defaults.get('group/%s' % group_name) or {}).copy())
# handle specific action defaults
- for action in redirected_names:
- if action in module_defaults:
- tmp_args.update(module_defaults[action].copy())
+ for redirected_action in redirected_names:
+ legacy = None
+ if redirected_action.startswith('ansible.legacy.') and action == redirected_action:
+ legacy = redirected_action.split('ansible.legacy.')[-1]
+ if legacy and legacy in module_defaults:
+ tmp_args.update(module_defaults[legacy].copy())
+ if redirected_action in module_defaults:
+ tmp_args.update(module_defaults[redirected_action].copy())
# direct args override all
tmp_args.update(args)