mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00: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:
committed by
Matt Davis
parent
cdf475e830
commit
8ef2e6da05
16
test/units/plugins/shell/test_cmd.py
Normal file
16
test/units/plugins/shell/test_cmd.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import pytest
|
||||
|
||||
from ansible.plugins.shell.cmd import ShellModule
|
||||
|
||||
|
||||
@pytest.mark.parametrize('s, expected', [
|
||||
['arg1', 'arg1'],
|
||||
[None, '""'],
|
||||
['arg1 and 2', '^"arg1 and 2^"'],
|
||||
['malicious argument\\"&whoami', '^"malicious argument\\^"^&whoami^"'],
|
||||
['C:\\temp\\some ^%file% > nul', '^"C:\\temp\\some ^^^%file^% ^> nul^"']
|
||||
])
|
||||
def test_quote_args(s, expected):
|
||||
cmd = ShellModule()
|
||||
actual = cmd.quote(s)
|
||||
assert actual == expected
|
||||
Reference in New Issue
Block a user