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:
parent
6bad4e57bd
commit
0715430829
1 changed files with 2 additions and 2 deletions
|
@ -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 `
|
||||
|
|
Loading…
Reference in a new issue