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

(GH-134) Only Enable AutoUninstaller in 0.9.9.x #137

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
*~
*.swp
pkg/
Gemfile.lock
Gemfile.local
spec/fixtures/
log/
junit/
.vagrant/
.bundle/
coverage/
.idea/
.metadata
*.iml
.*.sw[op]
.DS_Store
.rspec
tmp/

*.orig
*.bak
*.old
Expand All @@ -25,5 +40,7 @@ spec/reports
test/tmp
test/version_tmp
tmp
.idea
.DS_Store
/.idea/
/.vscode/
.config

50 changes: 29 additions & 21 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ group :development do
gem 'puppetlabs_spec_helper', :require => false
gem 'puppet_facts', :require => false
gem 'mocha', '~>0.10.5', :require => false
gem 'metadata-json-lint', '~> 0.0', :require => false
gem 'travis', '~>1.8', :require => false
#gem 'rspec-puppet-facts', :require => false
end

Expand Down Expand Up @@ -85,23 +83,23 @@ if explicitly_require_windows_gems
# This also means Puppet Gem less than 3.5.0 - this has been tested back
# to 3.0.0. Any further back is likely not supported.
if puppet_gem_location == :gem
gem 'ffi', '1.9.0', :require => false
gem 'win32-eventlog', '0.5.3', :require => false
gem 'win32-process', '0.6.5', :require => false
gem 'win32-security', '~> 0.1.2', :require => false
gem 'win32-service', '0.7.2', :require => false
gem 'minitar', '0.5.4', :require => false
gem "ffi", "1.9.0", :require => false
gem "win32-eventlog", "0.5.3","<= 0.6.5", :require => false
gem "win32-process", "0.6.5","<= 0.7.5", :require => false
gem "win32-security", "~> 0.1.2","<= 0.2.5", :require => false
gem "win32-service", "0.7.2","<= 0.8.7", :require => false
gem "minitar", "0.5.4", :require => false
else
gem 'ffi', '~> 1.9.0', :require => false
gem 'win32-eventlog', '~> 0.5', :require => false
gem 'win32-process', '~> 0.6', :require => false
gem 'win32-security', '~> 0.1', :require => false
gem 'win32-service', '~> 0.7', :require => false
gem 'minitar', '~> 0.5.4', :require => false
gem "ffi", "~> 1.9.0", :require => false
gem "win32-eventlog", "~> 0.5","<= 0.6.5", :require => false
gem "win32-process", "~> 0.6","<= 0.7.5", :require => false
gem "win32-security", "~> 0.1","<= 0.2.5", :require => false
gem "win32-service", "~> 0.7","<= 0.8.7", :require => false
gem "minitar", "~> 0.5.4", :require => false
end

gem 'win32-dir', '~> 0.3', :require => false
gem 'win32console', '1.3.2', :require => false if RUBY_VERSION =~ /^1\./
gem "win32-dir", "~> 0.3","<= 0.4.9", :require => false
gem "win32console", "1.3.2", :require => false if RUBY_VERSION =~ /^1\./

# Puppet less than 3.7.0 requires these.
# Puppet 3.5.0+ will control the actual requirements.
Expand All @@ -110,11 +108,21 @@ if explicitly_require_windows_gems
# We do not want to allow newer versions than what came out after
# 3.6.x to be used as they constitute some risk in breaking older
# functionality. So we set these to exact versions.
gem 'sys-admin', '1.5.6', :require => false
gem 'win32-api', '1.4.8', :require => false
gem 'win32-taskscheduler', '0.2.2', :require => false
gem 'windows-api', '0.4.3', :require => false
gem 'windows-pr', '1.2.3', :require => false
gem "sys-admin", "1.5.6", :require => false
gem "win32-api", "1.4.8", :require => false
gem "win32-taskscheduler", "0.2.2", :require => false
gem "windows-api", "0.4.3", :require => false
gem "windows-pr", "1.2.3", :require => false
else
if Gem::Platform.local.os == 'mingw32'
# If we're using a Puppet gem on windows, which handles its own win32-xxx gem dependencies (Pup 3.5.0 and above), set maximum versions
# Required due to PUP-6445
gem "win32-dir", "<= 0.4.9", :require => false
gem "win32-eventlog", "<= 0.6.5", :require => false
gem "win32-process", "<= 0.7.5", :require => false
gem "win32-security", "<= 0.2.5", :require => false
gem "win32-service", "<= 0.8.7", :require => false
end
end

if File.exists? "#{__FILE__}.local"
Expand Down
15 changes: 5 additions & 10 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,22 @@
# version less than 0.9.9 and we don't know what the
# user may link to - it could be an older version of
# Chocolatey
if versioncmp($chocolatey::chocolatey_version, '0.9.9.0') >= 0 {

# lint:ignore:80chars
if versioncmp($chocolatey::chocolatey_version, '0.9.9.0') >= 0 and versioncmp($chocolatey::chocolatey_version, '0.9.10.0') < 0 {
$_choco_exe_path = "${chocolatey::choco_install_location}\\bin\\choco.exe"

$_enable_autouninstaller = $chocolatey::enable_autouninstaller ? {
false => 'disable',
default => 'enable'
}

if versioncmp($chocolatey::chocolatey_version, '0.9.10.0') >= 0 {
$_find_str = "autoUninstaller|${_enable_autouninstaller}d|"
} else {
$_find_str = "autoUninstaller - [${_enable_autouninstaller}d]"
}

# lint:ignore:80chars
exec { "chocolatey_autouninstaller_${_enable_autouninstaller}":
path => $::path,
command => "${_choco_exe_path} feature -r ${_enable_autouninstaller} -n autoUninstaller",
unless => "cmd.exe /c ${_choco_exe_path} feature list -r | findstr /B /I /C:\"${_find_str}\"",
unless => "cmd.exe /c ${_choco_exe_path} feature list -r | findstr /B /I /C:\"autoUninstaller - [${_enable_autouninstaller}d]\"",
environment => ["ChocolateyInstall=${::chocolatey::choco_install_location}"]
}
# lint:endignore
}
# lint:endignore
}
30 changes: 19 additions & 11 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
# `chocolatey.nupkg`. This must be a url, but not necessarily an OData feed.
# Any old url location will work. Defaults to
# `'https://chocolatey.org/api/v2/package/chocolatey/'`.
# @param [Boolean] enable_autouninstaller Should auto uninstaller be turned on?
# Auto uninstaller is what allows Chocolatey to automatically manage the
# uninstall of software from Programs and Features without necessarily
# requiring a `chocolateyUninstall.ps1` file in the package. Defaults to
# `true`.
# @param [Boolean] enable_autouninstaller [Deprecated] - Should auto
# uninstaller be turned on? Auto uninstaller is what allows Chocolatey to
# automatically manage the uninstall of software from Programs and Features
# without necessarily requiring a `chocolateyUninstall.ps1` file in the
# package. Defaults to `true`. Setting is ignored in Chocolatey v0.9.10+.
# @param [Boolean] log_output Log output from the installer. Defaults to
# `false`.
# @param [String] chocolatey_version chocolatey version, falls back to
Expand All @@ -69,16 +69,24 @@
$chocolatey_version = $::chocolatey::params::chocolatey_version
) inherits ::chocolatey::params {


validate_string($choco_install_location)
# lint:ignore:140chars
validate_re($choco_install_location, '^\w\:',
"Please use a full path for choco_install_location starting with a local drive. Reference choco_install_location => '${choco_install_location}'."
)
# lint:endignore

validate_bool($use_7zip)
validate_integer($choco_install_timeout_seconds)

validate_string($chocolatey_download_url)
# lint:ignore:140chars
validate_re($chocolatey_download_url,['^http\:\/\/','^https\:\/\/','file\:\/\/\/'],
"For chocolatey_download_url, if not using the default '${::chocolatey::params::download_url}', please use a Http/Https/File Url that downloads 'chocolatey.nupkg'."
)
validate_bool($use_7zip)
validate_string($choco_install_location)
validate_re($choco_install_location, '^\w\:',
"Please use a full path for choco_install_location starting with a local drive. Reference choco_install_location => '${choco_install_location}'."
)
validate_integer($choco_install_timeout_seconds)
# lint:endignore

validate_bool($enable_autouninstaller)

if ((versioncmp($::clientversion, '3.4.0') >= 0) and (!defined('$::serverversion') or versioncmp($::serverversion, '3.4.0') >= 0)) {
Expand Down
13 changes: 0 additions & 13 deletions spec/unit/travis_spec.rb

This file was deleted.