mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07: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:
parent
afe29977cb
commit
3dbce15ccb
4 changed files with 167 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue