mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
fix Windows env handling (#22927)
* fixes #22441 * fixes #22655 * moves all env handling into the exec wrapper; this should work for everything but raw, which is consistent with non-Windows.
This commit is contained in:
parent
f1ab879bb6
commit
73f50b4f9f
8 changed files with 52 additions and 16 deletions
|
@ -81,11 +81,17 @@ class ActionModule(ActionBase):
|
|||
self._fixup_perms2((tmp, tmp_src), execute=True)
|
||||
|
||||
# add preparation steps to one ssh roundtrip executing the script
|
||||
env_string = self._compute_environment_string()
|
||||
env_dict = dict()
|
||||
env_string = self._compute_environment_string(env_dict)
|
||||
script_cmd = ' '.join([env_string, tmp_src, args])
|
||||
script_cmd = self._connection._shell.wrap_for_exec(script_cmd)
|
||||
|
||||
result.update(self._low_level_execute_command(cmd=script_cmd, sudoable=True))
|
||||
exec_data = None
|
||||
# HACK: come up with a sane way to pass around env outside the command
|
||||
if self._connection.transport == "winrm":
|
||||
exec_data = self._connection._create_raw_wrapper_payload(script_cmd, env_dict)
|
||||
|
||||
result.update(self._low_level_execute_command(cmd=script_cmd, in_data=exec_data, sudoable=True))
|
||||
|
||||
# clean up after
|
||||
self._remove_tmp_path(tmp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue