Closed DevOpsJeremy closed 11 months ago
The $robocopy variable doesn't exist. Changed cmd output to robocopy to match what actually gets run on line 85.
$robocopy
cmd
robocopy
The cmd property of the output only includes the robocopy arguments but not the robocopy executable itself.
win_robocopy
The module currently returns (for example) the following output in the cmd property:
"cmd": " C:\\path\\to\\source\\ C:\\path\\to\\destination\\ /e /l"
The current code for the win_robocopy.ps1 module is as follows:
win_robocopy.ps1
$result.cmd = "$robocopy $robocopy_opts"
Since no $robocopy variable exists nothing is returned, resulting in an erroneous leading space and incomplete command.
Validation instructions: Run any task using community.windows.win_robocopy and validate the cmd output property.
community.windows.win_robocopy
Before:
{ "dest": "C:\\path\\to\\destination\\", "src": "C:\\path\\to\\source\\", "msg": "Files copied successfully!", "flags": "", "output": [ "", "-------------------------------------------------------------------------------", " ROBOCOPY :: Robust File Copy for Windows ", "-------------------------------------------------------------------------------", "", " Started : Friday, December 22, 2023 3:05:13 AM", " Source : C:\\path\\to\\source\\", " Dest : C:\\path\\to\\destination\\", "", " Files : *.*", "\t ", " Options : *.* /S /E /DCOPY:DA /COPY:DAT /R:1000000 /W:30 ", "", "------------------------------------------------------------------------------", "", "\t New Dir 0\tC:\\path\\to\\destination\\", "\t New File \t\t 15185\tfile1.txt", " 0% ", "100% ", "", "------------------------------------------------------------------------------", "", " Total Copied Skipped Mismatch FAILED Extras", " Dirs : 1 1 0 0 0 0", " Files : 1 1 0 0 0 0", " Bytes : 88.4 k 88.4 k 0 0 0 0", " Times : 0:00:00 0:00:00 0:00:00 0:00:00", " Ended : Friday, December 22, 2023 3:05:13 AM", "" ], "purge": false, "changed": true, "rc": 1, "return_code": 1, "cmd": " C:\\path\\to\\source\\ C:\\path\\to\\destination\\", "recurse": true, "_ansible_no_log": false }
After
{ "dest": "C:\\path\\to\\destination\\", "src": "C:\\path\\to\\source\\", "msg": "Files copied successfully!", "flags": "", "output": [ "", "-------------------------------------------------------------------------------", " ROBOCOPY :: Robust File Copy for Windows ", "-------------------------------------------------------------------------------", "", " Started : Friday, December 22, 2023 3:05:13 AM", " Source : C:\\path\\to\\source\\", " Dest : C:\\path\\to\\destination\\", "", " Files : *.*", "\t ", " Options : *.* /S /E /DCOPY:DA /COPY:DAT /R:1000000 /W:30 ", "", "------------------------------------------------------------------------------", "", "\t New Dir 0\tC:\\path\\to\\destination\\", "\t New File \t\t 15185\tfile1.txt", " 0% ", "100% ", "", "------------------------------------------------------------------------------", "", " Total Copied Skipped Mismatch FAILED Extras", " Dirs : 1 1 0 0 0 0", " Files : 1 1 0 0 0 0", " Bytes : 88.4 k 88.4 k 0 0 0 0", " Times : 0:00:00 0:00:00 0:00:00 0:00:00", " Ended : Friday, December 22, 2023 3:05:13 AM", "" ], "purge": false, "changed": true, "rc": 1, "return_code": 1, "cmd": "robocopy C:\\path\\to\\source\\ C:\\path\\to\\destination\\", "recurse": true, "_ansible_no_log": false }
@jborean93 this is a quick & simple change without any functionality changes/risks so I think it's an easy merge if you agree, since you're the original author.
The
$robocopy
variable doesn't exist. Changedcmd
output torobocopy
to match what actually gets run on line 85.SUMMARY
The
cmd
property of the output only includes the robocopy arguments but not the robocopy executable itself.ISSUE TYPE
COMPONENT NAME
win_robocopy
ADDITIONAL INFORMATION
The module currently returns (for example) the following output in the cmd property:
"cmd": " C:\\path\\to\\source\\ C:\\path\\to\\destination\\ /e /l"
The current code for the
win_robocopy.ps1
module is as follows:$result.cmd = "$robocopy $robocopy_opts"
Since no
$robocopy
variable exists nothing is returned, resulting in an erroneous leading space and incomplete command.Validation instructions: Run any task using
community.windows.win_robocopy
and validate thecmd
output property.Before:
After