mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 06:30:19 -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
|
@ -162,14 +162,16 @@ class ActionBase(with_metaclass(ABCMeta, object)):
|
|||
# FUTURE: we'll have to get fancier about this to support powershell over SSH on Windows...
|
||||
if self._connection.transport == "winrm":
|
||||
# WinRM always pipelines, so we need to build up a fancier module payload...
|
||||
final_environment = dict()
|
||||
self._compute_environment_string(final_environment)
|
||||
module_data = build_windows_module_payload(module_name=module_name, module_path=module_path,
|
||||
b_module_data=module_data, module_args=module_args,
|
||||
task_vars=task_vars, task=self._task,
|
||||
play_context=self._play_context)
|
||||
play_context=self._play_context, environment=final_environment)
|
||||
|
||||
return (module_style, module_shebang, module_data, module_path)
|
||||
|
||||
def _compute_environment_string(self):
|
||||
def _compute_environment_string(self, raw_environment_out=dict()):
|
||||
'''
|
||||
Builds the environment string to be used when executing the remote task.
|
||||
'''
|
||||
|
@ -195,6 +197,11 @@ class ActionBase(with_metaclass(ABCMeta, object)):
|
|||
final_environment.update(temp_environment)
|
||||
|
||||
final_environment = self._templar.template(final_environment)
|
||||
|
||||
if isinstance(raw_environment_out, dict):
|
||||
raw_environment_out.clear()
|
||||
raw_environment_out.update(final_environment)
|
||||
|
||||
return self._connection._shell.env_prefix(**final_environment)
|
||||
|
||||
def _early_needs_tmp_path(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue