* Fixes #3539 "win_robocopy does not return changed properly" Remove .win_robocopy from $result so that ansible can see the values properly. This also matches up with the existing documentation. * Update documentation to match new return values
This commit is contained in:
parent
232cb764da
commit
0ffacedb3e
2 changed files with 12 additions and 15 deletions
|
@ -22,10 +22,8 @@
|
||||||
$params = Parse-Args $args;
|
$params = Parse-Args $args;
|
||||||
|
|
||||||
$result = New-Object psobject @{
|
$result = New-Object psobject @{
|
||||||
win_robocopy = New-Object psobject @{
|
|
||||||
recurse = $false
|
recurse = $false
|
||||||
purge = $false
|
purge = $false
|
||||||
}
|
|
||||||
changed = $false
|
changed = $false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,10 +68,10 @@ if (-Not (Test-Path $src)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$robocopy_opts += $src
|
$robocopy_opts += $src
|
||||||
Set-Attr $result.win_robocopy "src" $src
|
Set-Attr $result "src" $src
|
||||||
|
|
||||||
$robocopy_opts += $dest
|
$robocopy_opts += $dest
|
||||||
Set-Attr $result.win_robocopy "dest" $dest
|
Set-Attr $result "dest" $dest
|
||||||
|
|
||||||
if ($flags -eq $null) {
|
if ($flags -eq $null) {
|
||||||
if ($purge) {
|
if ($purge) {
|
||||||
|
@ -90,9 +88,9 @@ Else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Set-Attr $result.win_robocopy "purge" $purge
|
Set-Attr $result "purge" $purge
|
||||||
Set-Attr $result.win_robocopy "recurse" $recurse
|
Set-Attr $result "recurse" $recurse
|
||||||
Set-Attr $result.win_robocopy "flags" $flags
|
Set-Attr $result "flags" $flags
|
||||||
|
|
||||||
$robocopy_output = ""
|
$robocopy_output = ""
|
||||||
$rc = 0
|
$rc = 0
|
||||||
|
@ -111,8 +109,8 @@ Else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Set-Attr $result.win_robocopy "return_code" $rc
|
Set-Attr $result "return_code" $rc
|
||||||
Set-Attr $result.win_robocopy "output" $robocopy_output
|
Set-Attr $result "output" $robocopy_output
|
||||||
|
|
||||||
$cmd_msg = "Success"
|
$cmd_msg = "Success"
|
||||||
$changed = $false
|
$changed = $false
|
||||||
|
@ -163,8 +161,7 @@ switch ($rc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set-Attr $result "msg" $cmd_msg
|
||||||
Set-Attr $result.win_robocopy "msg" $cmd_msg
|
Set-Attr $result "changed" $changed
|
||||||
Set-Attr $result.win_robocopy "changed" $changed
|
|
||||||
|
|
||||||
Exit-Json $result
|
Exit-Json $result
|
||||||
|
|
|
@ -129,7 +129,7 @@ flags:
|
||||||
returned: always
|
returned: always
|
||||||
type: string
|
type: string
|
||||||
sample: "/e /purge"
|
sample: "/e /purge"
|
||||||
return_code:
|
rc:
|
||||||
description: The return code retuned by robocopy.
|
description: The return code retuned by robocopy.
|
||||||
returned: success
|
returned: success
|
||||||
type: int
|
type: int
|
||||||
|
|
Loading…
Reference in a new issue