mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
win_template: fix issue where dest was specified as a directory (#39887)
This commit is contained in:
@@ -368,7 +368,7 @@ if ($copy_mode -eq "query") {
|
||||
}
|
||||
|
||||
# the dest parameter is a directory, we need to append original_basename
|
||||
if ($dest.EndsWith("/") -or $dest.EndsWith("`\")) {
|
||||
if ($dest.EndsWith("/") -or $dest.EndsWith("`\") -or (Test-Path -Path $dest -PathType Container)) {
|
||||
$remote_dest = Join-Path -Path $dest -ChildPath $original_basename
|
||||
$parent_dir = Split-Path -Path $remote_dest
|
||||
|
||||
|
||||
@@ -15,6 +15,12 @@ $check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -default
|
||||
$path = Get-AnsibleParam -obj $params -name "path" -type "path" -failifempty $true -aliases "dest","name"
|
||||
$state = Get-AnsibleParam -obj $params -name "state" -type "str" -validateset "absent","directory","file","touch"
|
||||
|
||||
# used in template/copy when dest is the path to a dir and source is a file
|
||||
$original_basename = Get-AnsibleParam -obj $params -name "original_basename" -type "str"
|
||||
if ((Test-Path -Path $path -PathType Container) -and ($null -ne $original_basename)) {
|
||||
$path = Join-Path -Path $path -ChildPath $original_basename
|
||||
}
|
||||
|
||||
$result = @{
|
||||
changed = $false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user