@ -18,10 +18,10 @@ $diff_mode = Get-AnsibleParam -obj $params -name "_ansible_diff" -type "bool" -d
# query: win_copy action plugin wants to get the state of remote files to check whether it needs to send them
# query: win_copy action plugin wants to get the state of remote files to check whether it needs to send them
# remote: all copy action is happening remotely (remote_src=True)
# remote: all copy action is happening remotely (remote_src=True)
# single: a single file has been copied, also used with template
# single: a single file has been copied, also used with template
$ mode = Get-AnsibleParam -obj $params -name " mode" -type " str " -default " single " -validateset " explode " , " query " , " remote " , " single "
$ copy_ mode = Get-AnsibleParam -obj $params -name " _copy_ mode" -type " str " -default " single " -validateset " explode " , " query " , " remote " , " single "
# used in explode, remote and single mode
# used in explode, remote and single mode
$src = Get-AnsibleParam -obj $params -name " src " -type " path " -failifempty ( $ mode -in @ ( " explode " , " process " , " single " ) )
$src = Get-AnsibleParam -obj $params -name " src " -type " path " -failifempty ( $ copy_ mode -in @ ( " explode " , " process " , " single " ) )
$dest = Get-AnsibleParam -obj $params -name " dest " -type " path " -failifempty $true
$dest = Get-AnsibleParam -obj $params -name " dest " -type " path " -failifempty $true
# used in single mode
# used in single mode
@ -224,7 +224,7 @@ Function Extract-ZipLegacy($src, $dest) {
}
}
}
}
if ( $ mode -eq " query " ) {
if ( $ copy_ mode -eq " query " ) {
# we only return a list of files/directories that need to be copied over
# we only return a list of files/directories that need to be copied over
# the source of the local file will be the key used
# the source of the local file will be the key used
$changed_files = @ ( )
$changed_files = @ ( )
@ -271,7 +271,7 @@ if ($mode -eq "query") {
$result . files = $changed_files
$result . files = $changed_files
$result . directories = $changed_directories
$result . directories = $changed_directories
$result . symlinks = $changed_symlinks
$result . symlinks = $changed_symlinks
} elseif ( $ mode -eq " explode " ) {
} elseif ( $ copy_ mode -eq " explode " ) {
# a single zip file containing the files and directories needs to be
# a single zip file containing the files and directories needs to be
# expanded this will always result in a change as the calculation is done
# expanded this will always result in a change as the calculation is done
# on the win_copy action plugin and is only run if a change needs to occur
# on the win_copy action plugin and is only run if a change needs to occur
@ -294,7 +294,7 @@ if ($mode -eq "query") {
}
}
$result . changed = $true
$result . changed = $true
} elseif ( $ mode -eq " remote " ) {
} elseif ( $ copy_ mode -eq " remote " ) {
# all copy actions are happening on the remote side (windows host), need
# all copy actions are happening on the remote side (windows host), need
# too copy source and dest using PS code
# too copy source and dest using PS code
$result . src = $src
$result . src = $src
@ -359,7 +359,7 @@ if ($mode -eq "query") {
if ( $diff_mode ) {
if ( $diff_mode ) {
$result . diff . prepared = $diff
$result . diff . prepared = $diff
}
}
} elseif ( $ mode -eq " single " ) {
} elseif ( $ copy_ mode -eq " single " ) {
# a single file is located in src and we need to copy to dest, this will
# a single file is located in src and we need to copy to dest, this will
# always result in a change as the calculation is done on the Ansible side
# always result in a change as the calculation is done on the Ansible side
# before this is run. This should also never run in check mode
# before this is run. This should also never run in check mode