mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 06:30:19 -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
|
@ -310,7 +310,7 @@ class PlayContext(Base):
|
|||
if attr_val is not None:
|
||||
setattr(new_info, attr, attr_val)
|
||||
|
||||
# finally, use the MAGIC_VARIABLE_MAPPING dictionary to update this
|
||||
# next, use the MAGIC_VARIABLE_MAPPING dictionary to update this
|
||||
# connection info object with 'magic' variables from the variable list
|
||||
for (attr, variable_names) in iteritems(MAGIC_VARIABLE_MAPPING):
|
||||
for variable_name in variable_names:
|
||||
|
@ -328,6 +328,12 @@ class PlayContext(Base):
|
|||
elif new_info.become_method == 'su' and new_info.su_pass:
|
||||
setattr(new_info, 'become_pass', new_info.su_pass)
|
||||
|
||||
# finally, in the special instance that the task was specified
|
||||
# as a local action, override the connection in case it was changed
|
||||
# during some other step in the process
|
||||
if task._local_action:
|
||||
setattr(new_info, 'connection', 'local')
|
||||
|
||||
return new_info
|
||||
|
||||
def make_become_cmd(self, cmd, executable=None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue