mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
win_shortcut: Add missing $check_mode definition + bugfix + tests (#20911)
* win_shortcut: Add missing $check_mode definition For some reason this entry was missing, possible a merge-conflict gone wrong :-( * Added integration tests and bugfix Add missing changes.
This commit is contained in:
committed by
John R Barker
parent
afe29977cb
commit
3dbce15ccb
@@ -24,6 +24,7 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$params = Parse-Args $args -supports_check_mode $true
|
||||
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
|
||||
|
||||
$src = Get-AnsibleParam -obj $params -name "src" -type "path" -default $null
|
||||
$dest = Get-AnsibleParam -obj $params -name "dest" -type "path" -failifempty $true
|
||||
@@ -78,6 +79,13 @@ If ($state -eq "absent") {
|
||||
|
||||
# Compare existing values with new values, report as changed if required
|
||||
|
||||
If ($src -ne $null) {
|
||||
# Windows translates executables to absolute path, so do we
|
||||
If (Get-Command -Name $src -Type Application -ErrorAction SilentlyContinue) {
|
||||
$src = (Get-Command -Name $src -Type Application).Definition
|
||||
}
|
||||
}
|
||||
|
||||
If ($src -ne $null -and $ShortCut.TargetPath -ne $src) {
|
||||
$result.changed = $true
|
||||
$ShortCut.TargetPath = $src
|
||||
|
||||
Reference in New Issue
Block a user