mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 04:11:25 -07:00
Add support for Windows hosts in the SSH connection plugin (#47732)
* Add support for Windows hosts in the SSH connection plugin * fix Python 2.6 unit test and sanity issues * fix up connection tests in CI, disable SCP for now * ensure we don't pollute the existing environment during the test * Add connection_windows_ssh to classifier * use test dir for inventory file * Required powershell as default shell and fix tests * Remove exlicit become_methods on connection * clarify console encoding comment * ignore recent SCP errors in integration tests * Add cmd shell type and added more tests * Fix some doc issues * revises windows faq * add anchors for windows links * revises windows setup page * Update changelogs/fragments/windows-ssh.yaml Co-Authored-By: jborean93 <jborean93@gmail.com>
This commit is contained in:
parent
cdf475e830
commit
8ef2e6da05
24 changed files with 657 additions and 143 deletions
|
@ -65,11 +65,11 @@ class ActionModule(ActionBase):
|
|||
chdir = self._task.args.get('chdir')
|
||||
if chdir:
|
||||
# Powershell is the only Windows-path aware shell
|
||||
if self._connection._shell.SHELL_FAMILY == 'powershell' and \
|
||||
if getattr(self._connection._shell, "_IS_WINDOWS", False) and \
|
||||
not self.windows_absolute_path_detection.match(chdir):
|
||||
raise AnsibleActionFail('chdir %s must be an absolute path for a Windows remote node' % chdir)
|
||||
# Every other shell is unix-path-aware.
|
||||
if self._connection._shell.SHELL_FAMILY != 'powershell' and not chdir.startswith('/'):
|
||||
if not getattr(self._connection._shell, "_IS_WINDOWS", False) and not chdir.startswith('/'):
|
||||
raise AnsibleActionFail('chdir %s must be an absolute path for a Unix-aware remote node' % chdir)
|
||||
|
||||
# Split out the script as the first item in raw_params using
|
||||
|
@ -126,7 +126,7 @@ class ActionModule(ActionBase):
|
|||
exec_data = None
|
||||
# PowerShell runs the script in a special wrapper to enable things
|
||||
# like become and environment args
|
||||
if self._connection._shell.SHELL_FAMILY == "powershell":
|
||||
if getattr(self._connection._shell, "_IS_WINDOWS", False):
|
||||
# FUTURE: use a more public method to get the exec payload
|
||||
pc = self._play_context
|
||||
exec_data = ps_manifest._create_powershell_wrapper(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue