mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
Pass windows command as-is without splitting/rejoining parameters.
* Fixes extra spaces added between parameters from https://github.com/ansible/ansible-modules-core/issues/1929 * Correctly decode PowerShell command encoded as UTF-16-LE so that it displays correctly in debug messages, fixes the other issue from https://github.com/ansible/ansible-modules-core/issues/1929 * Add test to verify that script parameters are passed as-is, so $true is interpreted as a boolean, fixes https://github.com/ansible/ansible/issues/10947
This commit is contained in:
parent
87db5119ea
commit
1d15e8f37a
4 changed files with 29 additions and 4 deletions
|
@ -92,3 +92,12 @@
|
|||
assert:
|
||||
that:
|
||||
- "raw_result.stdout_lines[0] == 'wwe=raw'"
|
||||
|
||||
- name: run a raw command with unicode chars and quoted args (from https://github.com/ansible/ansible-modules-core/issues/1929)
|
||||
raw: Write-Host --% icacls D:\somedir\ /grant "! ЗАО. Руководство":F
|
||||
register: raw_result2
|
||||
|
||||
- name: make sure raw passes command as-is and doesn't split/rejoin args
|
||||
assert:
|
||||
that:
|
||||
- "raw_result2.stdout_lines[0] == '--% icacls D:\\\\somedir\\\\ /grant \"! ЗАО. Руководство\":F'"
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
Param(
|
||||
[bool]$boolvariable
|
||||
)
|
||||
|
||||
Write-Host $boolvariable.GetType()
|
||||
Write-Host $boolvariable
|
|
@ -171,3 +171,13 @@
|
|||
- "not test_cmd_result.stderr"
|
||||
- "not test_cmd_result|failed"
|
||||
- "test_cmd_result|changed"
|
||||
|
||||
- name: run test script that takes a boolean parameter
|
||||
script: test_script_bool.ps1 $true
|
||||
register: test_script_bool_result
|
||||
|
||||
- name: check that the script ran and the parameter was treated as a boolean
|
||||
assert:
|
||||
that:
|
||||
- "test_script_bool_result.stdout_lines[0] == 'System.Boolean'"
|
||||
- "test_script_bool_result.stdout_lines[1] == 'True'"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue