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-4091) Explicitly Set ChocolateyInstall Environment #53

Conversation

ferventcoder
Copy link

Previously, ensuring the installation directory for Chocolatey
keyed off of an environment value passed to an exec powershell
resource through the environment parameter. However there is a
bug in the powershell module in versions 2.x up to 2.1.0
(current version as of this commit) that ignore the environment
parameter. Since it is better to explicitly set that value, take
a dependency on the registry module and explicitly ensure the
environment variable is set so that Chocolatey will successfully
install to an alternative install location.

When looking at determining the version of Chocolatey for
configuration purposes in config.pp, determine if the value of
`$chocolatey::chocolatey_version` is coming back undefined. If
it is, return a string with 0 as the value. Add a local variable
to make that determination and use it instead of the fact in the
versioncmp checks.
# lint:ignore:80chars
if versioncmp($chocolatey::chocolatey_version, '0.9.9.0') >= 0 and versioncmp($chocolatey::chocolatey_version, '0.9.10.0') < 0 {
if versioncmp($_choco_version, '0.9.9.0') >= 0 and versioncmp($_choco_version, '0.9.10.0') < 0 {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny annoyance fixed as an additional maint commit.

exec { 'install_chocolatey_official':
command => template('chocolatey/InstallChocolatey.ps1.erb'),
creates => "${::chocolatey::choco_install_location}\\bin\\choco.exe",
provider => powershell,
timeout => $::chocolatey::choco_install_timeout_seconds,
logoutput => $::chocolatey::log_output,
environment => ["ChocolateyInstall=${::chocolatey::choco_install_location}"]
environment => ["ChocolateyInstall=${::chocolatey::choco_install_location}"],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not removing this in hopes that it will still get fixed.

ensure => present,
path => 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\ChocolateyInstall',
type => 'string',
data => $chocolatey::choco_install_location,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this needs quoted in case it has spaces.

Previously, ensuring the installation directory for Chocolatey
keyed off of an environment value passed to an exec powershell
resource through the environment parameter. However there is a
bug in the powershell module in versions 2.x up to 2.1.0
(current version as of this commit) that ignore the environment
parameter. Since it is better to explicitly set that value, take
a dependency on the registry module and explicitly ensure the
environment variable is set so that Chocolatey will successfully
install to an alternative install location.
@ferventcoder ferventcoder force-pushed the ticket/master/MODULES-4091-alternate_directory branch from 8d2f40f to c760fb6 Compare November 28, 2016 20:23
@jpogran jpogran merged commit 9772b72 into puppetlabs:master Nov 28, 2016
@ferventcoder ferventcoder deleted the ticket/master/MODULES-4091-alternate_directory branch November 28, 2016 23:02
ThoughtCrhyme pushed a commit to ThoughtCrhyme/puppetlabs-chocolatey that referenced this pull request Mar 20, 2017
Added in meta data for numerous QA modules
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