chocolatey-archive / puppet-chocolatey

Chocolatey package provider
Apache License 2.0
88 stars 133 forks source link

Puppet Ensure Latest not finding the latest package. #67

Open agray2 opened 9 years ago

agray2 commented 9 years ago

Hello. I am trying to make sure the latest package is installed using the Puppet Package resource, and chocolatey provider. Every time the puppet agent checks in with the Puppet Master, we want to make sure that the app installed on the client is at the latest version. Here is the specific code inside our Puppet Installer class:

package { $appName: ensure => latest, provider => 'chocolatey', source => $servicePackageRepo, install_options => [ '-packageparameters', "$appRoot\$appName\deploy.properties"] }

When this executes, I find puppet running this command to find the latest version:

Debug: Executing 'C:\ProgramData\chocolatey\chocolateyInstall\chocolatey.cmd version TaskManager | findstr /R "latest" | findstr /V "latestCompare" '

This always results in a null return:

Debug: /Stage[main]/Profiles::Taskmanager::Install/Package[TaskManager]/ensure: TaskManager "1.1.3" is installed, latest is nil

I extracted this command from the debug output and ran it myself, but added the source directory where our nupkg packages are located on the local machine:

'C:\ProgramData\chocolatey\chocolateyInstall\chocolatey.cmd version TaskManager –source C:\ProgramData\MorphoTrust\PuppetDeploy | findstr /R "latest" | findstr /V "latestCompare"

This then successfully returned the latest version found in that directory. Is there a way to get the source into the command Puppet uses to find the latest version? Or is there something else that I should be doing to ensure the latest package is always installed?

ferventcoder commented 9 years ago

Hello. It doesn't appear you are using a recent version of this provider. You can see from https://github.com/chocolatey/puppet-chocolatey/blob/master/lib/puppet/provider/package/chocolatey.rb#L19-L34 that we no longer call chocolatey.cmd.

Please upgrade to the latest version and let's see if your issue goes away.