chocolatey / cChoco

Community resource to manage Chocolatey
Apache License 2.0
154 stars 99 forks source link

[2.4.0.0] cChocoPackageInstaller: Test-TargetResource always `$false` with custom source #135

Closed bozho closed 4 years ago

bozho commented 4 years ago

There was a change in Test-TargetResource when passing a custom source to Test-LatestVersionInstalled

Previously, the code was:

        if ($AutoUpgrade -and $isInstalled) {
            $result = Test-LatestVersionInstalled -pName $Name -pSource $Source
        } else {
            $result = $isInstalled
        }

Current code it (line 167 in cChocoPackageInstall.psm1):

        if ($AutoUpgrade -and $isInstalled) {
            if ($Source){
                [string]$pSource = "-pSource `"$Source`""
            }
            $result = Test-LatestVersionInstalled -pName $Name $pSource
        } else {
            $result = $isInstalled
        }

which results in choco being executed as:

choco upgrade <package> --noop --source="-pSource "<custom_source>""