-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(MODULES-4562) Use actual choco.exe #77
(MODULES-4562) Use actual choco.exe #77
Conversation
Sometimes when running the shimmed choco, it can cause issues and it ends up returning the version of choco as '0'. When managing configuration, this can cause issues using those resources, such as the following: `Failed to apply catalog: Validation of Chocolateysource[chocolatey] failed: Chocolatey version must be '0.9.9.0' to manage configuration values with Puppet. Detected '0' as your version. Please upgrade Chocolatey to use this resource.` On the next run of Puppet, everything works again appropriately. The event log shows an issue with attempting to run the shim. In order to avoid this altogether, just use choco.exe directly when running Puppet.
|
|
||
| chocolateysource { 'local': | ||
| location => 'c:\packages', | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from a maint commit - gave up trying to fight with git and .gitattributes to reset the index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I had the same issue. Thanks for fixing this!
| @@ -9,7 +9,7 @@ class ChocolateyVersion | |||
|
|
|||
| def self.version | |||
| version = nil | |||
| choco_path = "#{PuppetX::Chocolatey::ChocolateyInstall.install_path}\\bin\\choco.exe" | |||
| choco_path = "#{PuppetX::Chocolatey::ChocolateyInstall.install_path}\\choco.exe" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arguably this is the one place this change is necessary, however I decided to make the change for the whole provider as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from one question. PR looks good
| chocopath = (chocoInstallPath if (chocoInstallPath && file_exists?("#{chocoInstallPath}\\bin\\choco.exe"))) || | ||
| ('C:\ProgramData\chocolatey' if file_exists?('C:\ProgramData\chocolatey\bin\choco.exe')) || | ||
| ('C:\Chocolatey' if file_exists?('C:\Chocolatey\bin\choco.exe')) || | ||
| chocopath = (chocoInstallPath if (chocoInstallPath && file_exists?("#{chocoInstallPath}\\choco.exe"))) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would there ever be the case of choco.exe not existing but bin\choco.exe does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not if you support only 0.9.9+ (which this module only supports that). If by chance there is the scenario you describe, that shim won't work because bin\choco.exe (the shim) is looking for choco.exe. HTH
Sometimes when running the shimmed choco, it can cause issues and
it ends up returning the version of choco as '0'. When managing
configuration, this can cause issues using those resources, such
as the following:
Failed to apply catalog: Validation of Chocolateysource[chocolatey] failed: Chocolatey version must be '0.9.9.0' to manage configuration values with Puppet. Detected '0' as your version. Please upgrade Chocolatey to use this resource.On the next run of Puppet, everything works again appropriately. The
event log shows an issue with attempting to run the shim. In order
to avoid this altogether, just use choco.exe directly when running
Puppet.