Skip to content

Commit

Permalink
Merge branch 'master' into ticket/master/MODULES-3490-sync
Browse files Browse the repository at this point in the history
* master:
  (version) 1.2.6
  (MODULES-3536) modsync update
  (maint) Remove travis and metadata-json-lint gems
  (chocolatey-archiveGH-134) Only Enable AutoUninstaller in 0.9.9.x
  (version) 1.2.5
  (maint) prep for release of 1.2.5
  (chocolatey-archiveGH-128) PowerShell 1.x provider fixes for "else"
  (chocolatey-archiveGH-133) Feature list update for  0.9.10
  (version) 1.2.4
  (chocolatey-archiveGH-125) Compatible Up to PowerShell Provider 3.x
  (chocolatey-archiveGH-125) Wrap PowerShell Redirect in Try/Catch
  (chocolatey-archiveGH-69) Fix - default provider example
  (doc) make that text a bit more prominent
  (version) 1.2.3 for real
  (version) 1.2.3
  (doc) add editions of Chocolatey
  (chocolatey-archiveGH-100) Do not call choco with --debug --verbose
  (version) 1.2.2
  Sign the installer script template
  (chocolatey-archiveGH-119) Implement PowerShell Redirection Fix
  • Loading branch information
ferventcoder committed Jul 11, 2016
2 parents 00f9044 + 5cffb5f commit 845d93c
Show file tree
Hide file tree
Showing 8 changed files with 217 additions and 139 deletions.
37 changes: 33 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,46 @@
## 2016-06-01 Unsupported Release 0.7.0

* Manage sources - `chocolateysource` - see [MODULES-3037](https://tickets.puppetlabs.com/browse/MODULES-3037)
* $::chocolateyversion fact is optional - see [#110](https://github.com/chocolatey/puppet-chocolatey/issues/110)
* Fix: puppet apply works again - see [#105](https://github.com/chocolatey/puppet-chocolatey/issues/105)
* Includes community module releases up to 1.2.1, plus these additional fixes:
* $::chocolateyversion fact is optional - see [#110](https://github.com/chocolatey/puppet-chocolatey/issues/110)
* Fix: puppet apply works again - see [#105](https://github.com/chocolatey/puppet-chocolatey/issues/105)


# Original Approved Module Changelog - Chocolatey Team
# Approved Community Module Changelog - Chocolatey Team

The Chocolatey team has graciously agreed to allow Puppet to take this module
to the next level. Puppet will rerelease a supported module under the original
versioning scheme. For now we are using a number less than 1.0 to show that this
could have some technical issues and should be treated as a prerelease version.

## 2016-07-11 Release 1.2.6

- Fix - AutoUninstaller runs every time in 0.9.9.x [#134](https://github.com/chocolatey/puppet-chocolatey/issues/134)

## 2016-06-20 Release 1.2.5

- Support feature list changes in v0.9.10+ [#133](https://github.com/chocolatey/puppet-chocolatey/issues/133)
- Fix - Chocolatey fails to install in PowerShell v2 with PowerShell Module 1.x [#128](https://github.com/chocolatey/puppet-chocolatey/issues/128)

## 2016-06-04 Release 1.2.4

- Compatibility with puppetlabs-powershell 2.x [#125](https://github.com/chocolatey/puppet-chocolatey/issues/125).

## 2016-05-06 Release 1.2.3

- Do not call choco with --debug --verbose by default [#100](https://github.com/chocolatey/puppet-chocolatey/issues/100).
- Announce [Chocolatey for Business](https://chocolatey.org/compare) in ReadMe.

## 2016-05-06 Release 1.2.3

- Do not call choco with --debug --verbose by default [#100](https://github.com/chocolatey/puppet-chocolatey/issues/100).
- Announce Chocolatey for Business in ReadMe.

## 2016-04-06 Release 1.2.2

- Fix: puppet apply works again [#105](https://github.com/chocolatey/puppet-chocolatey/issues/105).
- `$::chocolateyversion` fact is optional - see [#110](https://github.com/chocolatey/puppet-chocolatey/issues/110)
- Fix: Implement PowerShell Redirection Fix for Windows 2008 / PowerShell v2 - see [#119](https://github.com/chocolatey/puppet-chocolatey/issues/119)

## 2015-12-08 Release 1.2.1
- Small release for support of newer PE versions.

Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Chocolatey Package Provider for Puppet

### Chocolatey for Business Now Available!

We're excited for you to learn more about what's available in the [Business editions](https://chocolatey.org/compare)!

## Build Status

Travis | AppVeyor
Expand Down Expand Up @@ -42,7 +46,10 @@ range of Puppet versions.
This is the official module for working with the [Chocolatey](https://chocolatey.org/about)
package manager.

This module supports all editions of Chocolatey, including FOSS, [Professional](https://chocolatey.org/compare) and [Chocolatey for Business](https://chocolatey.org/compare).

This module will ultimately be able to

* install Chocolatey
* work with custom location installations
* configure Chocolatey
Expand Down Expand Up @@ -257,8 +264,9 @@ if $::kernel == 'windows' {
# OR
case $operatingsystem {
'windows':
'windows': {
Package { provider => chocolatey, }
}
}
~~~

Expand Down
6 changes: 3 additions & 3 deletions lib/puppet/provider/package/chocolatey.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def install
end

if choco_exe
args << '-dvy'
args << '-y'
end

args << @resource[:install_options]
Expand All @@ -103,7 +103,7 @@ def uninstall
args = 'uninstall', @resource[:name][/\A\S*/]

if choco_exe
args << '-dvfy'
args << '-fy'
end

args << @resource[:uninstall_options]
Expand All @@ -125,7 +125,7 @@ def update
unhold if choco_exe

if choco_exe
args = 'upgrade', @resource[:name][/\A\S*/], '-dvy'
args = 'upgrade', @resource[:name][/\A\S*/], '-y'
else
args = 'update', @resource[:name][/\A\S*/]
end
Expand Down
7 changes: 4 additions & 3 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +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'
}

# 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:\"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
6 changes: 4 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"dot_net",
"chocolatey",
"package",
"package manager"
"package manager",
"chocolatey for business",
"chocolatey professional"
],
"requirements": [
{
Expand Down Expand Up @@ -49,7 +51,7 @@
},
{
"name": "puppetlabs/powershell",
"version_requirement": ">= 1.0.1 < 2.0.0"
"version_requirement": ">= 1.0.1 < 3.0.0"
},
{
"name": "badgerious/windows_env",
Expand Down
20 changes: 10 additions & 10 deletions spec/unit/puppet/provider/package/chocolatey_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,29 +71,29 @@

it "should use install command without versioned package" do
resource[:ensure] = :present
@provider.expects(:chocolatey).with('install', 'chocolatey','-dvy', nil)
@provider.expects(:chocolatey).with('install', 'chocolatey','-y', nil)

@provider.install
end

it "should use upgrade command with versioned package" do
resource[:ensure] = '1.2.3'
@provider.expects(:chocolatey).with('upgrade', 'chocolatey', '-version', '1.2.3', '-dvy', nil)
@provider.expects(:chocolatey).with('upgrade', 'chocolatey', '-version', '1.2.3', '-y', nil)

@provider.install
end

it "should call install instead of upgrade if package name ends with .config" do
resource[:name] = "packages.config"
resource[:ensure] = :present
@provider.expects(:chocolatey).with('install', 'packages.config','-dvy', nil)
@provider.expects(:chocolatey).with('install', 'packages.config','-y', nil)

@provider.install
end

it "should use source if it is specified" do
resource[:source] = 'c:\packages'
@provider.expects(:chocolatey).with('install','chocolatey','-dvy', nil, '-source', 'c:\packages')
@provider.expects(:chocolatey).with('install','chocolatey','-y', nil, '-source', 'c:\packages')

@provider.install
end
Expand Down Expand Up @@ -143,7 +143,7 @@

it "should use install command with held package" do
resource[:ensure] = :held
@provider.expects(:chocolatey).with('install', 'chocolatey','-dvy', nil)
@provider.expects(:chocolatey).with('install', 'chocolatey','-y', nil)
@provider.expects(:chocolatey).with('pin', 'add', '-n', 'chocolatey')

@provider.hold
Expand Down Expand Up @@ -173,14 +173,14 @@
end

it "should call the remove operation" do
@provider.expects(:chocolatey).with('uninstall', 'chocolatey','-dvfy', nil)
@provider.expects(:chocolatey).with('uninstall', 'chocolatey','-fy', nil)

@provider.uninstall
end

it "should use ignore source if it is specified" do
resource[:source] = 'c:\packages'
@provider.expects(:chocolatey).with('uninstall','chocolatey','-dvfy', nil)
@provider.expects(:chocolatey).with('uninstall','chocolatey','-fy', nil)

@provider.uninstall
end
Expand Down Expand Up @@ -222,14 +222,14 @@
:name => "chocolatey",
:provider => :chocolatey,
})]
@provider.expects(:chocolatey).with('upgrade', 'chocolatey', '-dvy', nil)
@provider.expects(:chocolatey).with('upgrade', 'chocolatey', '-y', nil)

@provider.update
end

it "should use `chocolatey install` when ensure latest and package absent" do
provider.stubs(:instances).returns []
@provider.expects(:chocolatey).with('install', 'chocolatey', '-dvy', nil)
@provider.expects(:chocolatey).with('install', 'chocolatey', '-y', nil)

@provider.update
end
Expand All @@ -241,7 +241,7 @@
:provider => :chocolatey,
})]
resource[:source] = 'c:\packages'
@provider.expects(:chocolatey).with('upgrade','chocolatey', '-dvy', nil, '-source', 'c:\packages')
@provider.expects(:chocolatey).with('upgrade','chocolatey', '-y', nil, '-source', 'c:\packages')

@provider.update
end
Expand Down
Loading

0 comments on commit 845d93c

Please sign in to comment.