Closed electricJP closed 1 year ago
Thanks, will have a look. How many source do you have configured on that node?
Only 1 so far. But as choco is global for the system I do prefer list the source I want (tested and created if needed earlier in the DSC)..
Ok. What happens when you run:
Test-ChocolateyPackageIsInstalled -name EMCOPY64 -source ChocoGL -version latest
Can you post the error trace here?
I guess you mean to run it on a system w/o the installed package. So here it is (notice the difference with -verbose:
PS C:\Windows\system32> Test-ChocolateyPackageIsInstalled -name EMCOPY64 -source ChocoGL -version latest -Verbose
VERBOSE: choco list -r --local-only
VERBOSE: Could not find Package EMCOPY64
VERBOSE: choco list -r -s"ChocoGL"
VERBOSE: No packages match the selection and need Installing.
PackagePresent VersionGreaterOrEqual
-------------- ---------------------
False False
PS C:\Windows\system32> Test-ChocolateyPackageIsInstalled -name EMCOPY64 -source ChocoGL -version latest
Method invocation failed because [System.Management.Automation.PSCustomObject] does not contain a method named 'Where'.
At C:\Program Files\WindowsPowerShell\Modules\chocolatey\0.0.50\Chocolatey.psm1:1418 char:13
+ $UnfilteredResults.Where{
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Where:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
PackagePresent VersionGreaterOrEqual
-------------- ---------------------
False False
Thanks, will look into it. The difference might not be because of -verbose
but because of caching... We'll see...
Hi, I think it's fixed. Please try v0.0.58 from the gallery and let me know :)
Thanks
Sorry, but I get a new error now. Same DSC as above, result=
VERBOSE: [MTL-VD01]: LCM: [ Start Set ]
VERBOSE: [MTL-VD01]: LCM: [ Start Resource ] [[ChocolateyPackage]EMCopy]
VERBOSE: [MTL-VD01]: LCM: [ Start Test ] [[ChocolateyPackage]EMCopy]
VERBOSE: [MTL-VD01]: [[ChocolateyPackage]EMCopy] Converting CIMInstance[] to hashtable
VERBOSE: [MTL-VD01]: [[ChocolateyPackage]EMCopy] >> Converting CIM Pairs
VERBOSE: [MTL-VD01]: [[ChocolateyPackage]EMCopy] Testing whether the Package EMCOPY64 is Installed
Cannot bind argument to parameter 'Path' because it is null.
+ CategoryInfo : InvalidData: (:) [], CimException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
+ PSComputerName : mtl-vd01.gameloft.org
Cannot bind argument to parameter 'Path' because it is null.
+ CategoryInfo : InvalidData: (:) [], CimException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
+ PSComputerName : mtl-vd01.gameloft.org
VERBOSE: [MTL-VD01]: LCM: [ End Test ] [[ChocolateyPackage]EMCopy] in 3.6270 seconds.
from the server itself:
PS C:\Windows\system32> Get-InstalledModule -Name chocolatey
Version Name Repository Description
------- ---- ---------- -----------
0.0.58 Chocolatey PSGL This is an unofficial module with DSC resource to Install and configure Chocolatey.
PS C:\Windows\system32> Test-ChocolateyPackageIsInstalled -name EMCOPY64 -source ChocoGL -version latest
PackagePresent VersionGreaterOrEqual
-------------- ---------------------
False False
Same error here, having a look into it.
@gaelcolas, do you still use these resources or would you recommend another DSC resource for Chocolatey?
Found something. These two environment variables were missing in my case:
PS C:\> dir env:choco*
Name Value
---- -----
ChocolateyInstall C:\ProgramData\chocolatey
ChocolateyLastPathUpdate 132270085137136849
I have installed Chocolatey and did not restart the machine. After the restart, everything worked as expected.
I do but might be pinned to a former version.
The resource will probably be moved to the chocolatey organisation as soon as I get a chance (maybe Wednesday).
ok so I've changed the way the module works (loads the Path variable from machine to $env:Path upon loading the module, and rewrote the resource to class-based. That should be fixed, closing.
Hello,
Considering this DSC usage:
will result in:
if the package is already installed (from Install-ChocolateyPackage), there is no error: