1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

win_chocolatey: Perform exact presence check (#23098)

The current implementation matches libreoffice-oldstable when testing for libreoffice.
So uninstalling libreoffice fails when libreoffice-oldstable is installed.

```
PS C:\WINDOWS\system32> choco list --local-only libreoffice
Chocolatey v0.10.3
libreoffice-oldstable 5.2.6
1 packages installed.
PS C:\WINDOWS\system32> choco list --local-only --exact libreoffice
Chocolatey v0.10.3
0 packages installed.
```

The solution is easy, just add `--exact`.
This commit is contained in:
Dag Wieers 2017-04-04 18:39:27 +02:00 committed by Matt Davis
parent 6bad4e57bd
commit 0715430829

View file

@ -100,7 +100,7 @@ Function Choco-IsInstalled
[string]$package
)
$cmd = "$executable list --local-only $package"
$cmd = "$executable list --local-only --exact $package"
$output = invoke-expression $cmd
$result.rc = $LastExitCode
@ -249,7 +249,7 @@ Function Choco-Install
if (Choco-IsInstalled $package)
{
if ($upgrade)
if ($state -eq "latest")
{
Choco-Upgrade -package $package -version $version -source $source -force $force `
-installargs $installargs -packageparams $packageparams `