Skip to content
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

Conversation

ferventcoder
Copy link

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.

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',
}
Copy link
Author

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.

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"
Copy link
Author

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.

Copy link

@glennsarti glennsarti left a 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"))) ||

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

Copy link
Author

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

@glennsarti glennsarti merged commit 82a205b into puppetlabs:master May 5, 2017
@ferventcoder ferventcoder deleted the ticket/master/MODULES-4562_use_original_choco branch May 5, 2017 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants