win_owner: added tests and fixed up bool handling (#25088)

* win_owner: added tests and fixed up bool handling

* explicitly gathering facts in test

* Removed manualy entry in test group
This commit is contained in:
Jordan Borean 2017-06-20 02:43:44 +10:00 committed by jhawkesworth
commit c05d3c3821
5 changed files with 239 additions and 6 deletions

View file

@ -90,7 +90,7 @@ $check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "b
$path = Get-AnsibleParam -obj $params -name "path" -type "path" -failifempty $true
$user = Get-AnsibleParam -obj $params -name "user" -type "str" -failifempty $true
$recurse = Get-AnsibleParam -obj $params -name "recurse" -type "bool" -default "no" -validateset "no","yes" -resultobj $result
$recurse = Get-AnsibleParam -obj $params -name "recurse" -type "bool" -default $false -resultobj $result
If (-Not (Test-Path -Path $path)) {
Fail-Json $result "$path file or directory does not exist on the host"
@ -129,7 +129,7 @@ Try {
}
}
Catch {
Fail-Json $result "an error occurred when attempting to change owner on $path for $user"
Fail-Json $result "an error occurred when attempting to change owner on $path for $($user): $($_.Exception.Message)"
}
Exit-Json $result

View file

@ -45,10 +45,8 @@ options:
recurse:
description:
- Indicates if the owner should be changed recursively
choices:
- no
- yes
default: no
type: bool
default: 'no'
author: Hans-Joachim Kliemeck (@h0nIg)
'''