mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 03:11:24 -07:00
Track local_action internally to prevent it from being overridden
Fixes #12053
This commit is contained in:
parent
d8b671ca76
commit
49ca0eb797
4 changed files with 31 additions and 4 deletions
|
@ -253,16 +253,16 @@ class ModuleArgsParser:
|
|||
action, args = self._normalize_parameters(thing, additional_args=additional_args)
|
||||
|
||||
# local_action
|
||||
local_action = False
|
||||
if 'local_action' in self._task_ds:
|
||||
# local_action is similar but also implies a connection='local'
|
||||
if action is not None:
|
||||
raise AnsibleParserError("action and local_action are mutually exclusive", obj=self._task_ds)
|
||||
thing = self._task_ds.get('local_action', '')
|
||||
connection = 'local'
|
||||
local_action = True
|
||||
action, args = self._normalize_parameters(thing, additional_args=additional_args)
|
||||
|
||||
# module: <stuff> is the more new-style invocation
|
||||
|
||||
# walk the input dictionary to see we recognize a module name
|
||||
for (item, value) in iteritems(self._task_ds):
|
||||
if item in module_loader or item == 'meta' or item == 'include':
|
||||
|
@ -287,4 +287,8 @@ class ModuleArgsParser:
|
|||
# shell modules require special handling
|
||||
(action, args) = self._handle_shell_weirdness(action, args)
|
||||
|
||||
# now add the local action flag to the args, if it was set
|
||||
if local_action:
|
||||
args['_local_action'] = local_action
|
||||
|
||||
return (action, args, connection)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue