Fixes #3539 "win_robocopy does not return changed properly" (#20158)

* 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:
Matthew Dawson 2017-01-12 23:04:14 +00:00 committed by Matt Davis
parent 232cb764da
commit 0ffacedb3e
2 changed files with 12 additions and 15 deletions

View file

@ -22,10 +22,8 @@
$params = Parse-Args $args;
$result = New-Object psobject @{
win_robocopy = New-Object psobject @{
recurse = $false
purge = $false
}
changed = $false
}
@ -70,10 +68,10 @@ if (-Not (Test-Path $src)) {
}
$robocopy_opts += $src
Set-Attr $result.win_robocopy "src" $src
Set-Attr $result "src" $src
$robocopy_opts += $dest
Set-Attr $result.win_robocopy "dest" $dest
Set-Attr $result "dest" $dest
if ($flags -eq $null) {
if ($purge) {
@ -90,9 +88,9 @@ Else {
}
}
Set-Attr $result.win_robocopy "purge" $purge
Set-Attr $result.win_robocopy "recurse" $recurse
Set-Attr $result.win_robocopy "flags" $flags
Set-Attr $result "purge" $purge
Set-Attr $result "recurse" $recurse
Set-Attr $result "flags" $flags
$robocopy_output = ""
$rc = 0
@ -111,8 +109,8 @@ Else {
}
}
Set-Attr $result.win_robocopy "return_code" $rc
Set-Attr $result.win_robocopy "output" $robocopy_output
Set-Attr $result "return_code" $rc
Set-Attr $result "output" $robocopy_output
$cmd_msg = "Success"
$changed = $false
@ -163,8 +161,7 @@ switch ($rc)
}
}
Set-Attr $result.win_robocopy "msg" $cmd_msg
Set-Attr $result.win_robocopy "changed" $changed
Set-Attr $result "msg" $cmd_msg
Set-Attr $result "changed" $changed
Exit-Json $result

View file

@ -129,7 +129,7 @@ flags:
returned: always
type: string
sample: "/e /purge"
return_code:
rc:
description: The return code retuned by robocopy.
returned: success
type: int