mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
windows: fix list type in legacy module utils (#30483)
* windows: fix list type in legacy module utils * only change the return for the list type instead of affecting it all * additional null check when using an array
This commit is contained in:
parent
b7b57a811a
commit
01563ccd5d
3 changed files with 35 additions and 1 deletions
|
@ -0,0 +1,12 @@
|
|||
#powershell
|
||||
|
||||
#Requires -Module Ansible.ModuleUtils.Legacy
|
||||
|
||||
$params = Parse-Args $args
|
||||
$value = Get-AnsibleParam -Obj $params -Name value -Type list
|
||||
|
||||
if ($value -isnot [array]) {
|
||||
Fail-Json -obj @{} -message "value was not a list but was $($value.GetType().FullName)"
|
||||
}
|
||||
|
||||
Exit-Json @{ count = $value.Count }
|
|
@ -21,3 +21,21 @@
|
|||
- path: '{{ bogus_driveletter.stdout_lines[0] }}:\goodpath'
|
||||
- path: '{{ bogus_driveletter.stdout_lines[0] }}:\badpath*%@:\blar'
|
||||
should_fail: true
|
||||
|
||||
- name: test list parameters
|
||||
testlist:
|
||||
value: '{{item.value}}'
|
||||
register: list_tests
|
||||
failed_when: list_tests|failed or list_tests.count != item.count
|
||||
with_items:
|
||||
- value: []
|
||||
count: 0
|
||||
- value:
|
||||
- 1
|
||||
- 2
|
||||
count: 2
|
||||
- value:
|
||||
- 1
|
||||
count: 1
|
||||
- value: "1, 2"
|
||||
count: 2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue