Showing with 1,709 additions and 1,311 deletions.
  1. +5 −5 .fixtures.yml
  2. +2 −0 .gitignore
  3. +0 −4 .sync.yml
  4. +20 −11 .travis.yml
  5. +18 −10 Gemfile
  6. +18 −3 README.markdown
  7. +6 −7 files/solaris_start_puppet.sh
  8. +19 −0 lib/puppet/parser/functions/windows_msi_installargs.rb
  9. +9 −8 manifests/init.pp
  10. +9 −109 manifests/install.pp
  11. +0 −169 manifests/install/remove_packages.pp
  12. +0 −62 manifests/install/remove_packages_osx.pp
  13. +8 −0 manifests/osfamily/aix.pp
  14. +4 −0 manifests/osfamily/darwin.pp
  15. +1 −1 manifests/osfamily/solaris.pp
  16. +6 −2 manifests/osfamily/suse.pp
  17. +12 −9 manifests/params.pp
  18. +0 −11 manifests/prepare.pp
  19. +4 −3 manifests/service.pp
  20. +27 −17 manifests/windows/install.pp
  21. +9 −10 metadata.json
  22. +6 −24 spec/acceptance/class_spec.rb
  23. +31 −51 spec/classes/puppet_agent_osfamily_aix_spec.rb
  24. +20 −46 spec/classes/puppet_agent_osfamily_darwin_spec.rb
  25. +16 −3 spec/classes/puppet_agent_osfamily_debian_spec.rb
  26. +4 −85 spec/classes/puppet_agent_osfamily_redhat_spec.rb
  27. +41 −130 spec/classes/puppet_agent_osfamily_solaris_spec.rb
  28. +10 −52 spec/classes/puppet_agent_osfamily_suse_spec.rb
  29. +6 −6 spec/classes/puppet_agent_osfamily_windows_spec.rb
  30. +8 −122 spec/classes/puppet_agent_prepare_spec.rb
  31. +0 −49 spec/classes/puppet_agent_prepare_stringify_facts_spec.rb
  32. +18 −51 spec/classes/puppet_agent_spec.rb
  33. +84 −104 spec/classes/puppet_agent_windows_install_spec.rb
  34. +13 −19 spec/spec_helper_acceptance.rb
  35. +1 −34 spec/unit/facter/settings_spec.rb
  36. +7 −0 task_spec/.fixtures.yml
  37. +13 −0 task_spec/Rakefile
  38. +75 −0 task_spec/spec/acceptance/init_spec.rb
  39. +10 −0 task_spec/spec/acceptance/nodesets/centos-7-x64.yml
  40. +14 −0 task_spec/spec/acceptance/nodesets/docker/centos-7.yml
  41. +13 −0 task_spec/spec/acceptance/nodesets/docker/debian-8.yml
  42. +14 −0 task_spec/spec/acceptance/nodesets/docker/ubuntu-14.04.yml
  43. +11 −0 task_spec/spec/acceptance/nodesets/docker/ubuntu-18.04.yml
  44. +13 −0 task_spec/spec/acceptance/nodesets/osx1011-64.yml
  45. +13 −0 task_spec/spec/acceptance/nodesets/osx1012-64.yml
  46. +13 −0 task_spec/spec/acceptance/nodesets/osx1013-64.yml
  47. +13 −0 task_spec/spec/acceptance/nodesets/sles11-64.yml
  48. +13 −0 task_spec/spec/acceptance/nodesets/sles12-64.yml
  49. +14 −0 task_spec/spec/acceptance/nodesets/windows10ent-32.yml
  50. +14 −0 task_spec/spec/acceptance/nodesets/windows10ent-64.yml
  51. +23 −0 task_spec/spec/spec_helper_acceptance.rb
  52. +17 −0 tasks/install.json
  53. +14 −0 tasks/install_powershell.json
  54. +75 −0 tasks/install_powershell.ps1
  55. +15 −0 tasks/install_shell.json
  56. +496 −0 tasks/install_shell.sh
  57. +8 −0 tasks/version.json
  58. +5 −0 tasks/version_powershell.json
  59. +16 −0 tasks/version_powershell.ps1
  60. +6 −0 tasks/version_shell.json
  61. +8 −0 tasks/version_shell.sh
  62. +0 −83 templates/install_puppet.bat.erb
  63. +334 −0 templates/install_puppet.ps1.erb
  64. +6 −11 templates/solaris_install.sh.erb
  65. +1 −0 types/arch.pp
10 changes: 5 additions & 5 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ fixtures:
forge_modules:
stdlib:
repo: "puppetlabs/stdlib"
ref: "4.12.0"
transition:
repo: "puppetlabs/transition"
ref: "5.1.0"
inifile:
repo: "puppetlabs/inifile"
ref: "2.1.0"
ref: "2.4.0"
apt:
repo: "puppetlabs/apt"
ref: "2.3.0"
ref: "6.0.0"
yumrepo_core:
repo: "puppetlabs/yumrepo_core"
symlinks:
puppet_agent: "#{source_dir}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ log/
pkg/
spec/fixtures/manifests/
spec/fixtures/modules/
task_spec/spec/fixtures/manifests/
task_spec/spec/fixtures/modules/
tmp/
vendor/

Expand Down
4 changes: 0 additions & 4 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
- 'x64_mingw'
- gem: 'puppet-module-posix-dev-r#{minor_version}'
platforms: 'ruby'
version: '0.3.3'
- gem: 'puppet-module-win-dev-r#{minor_version}'
platforms:
- 'mswin'
Expand All @@ -72,9 +71,6 @@
condition: "Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')"
- gem: fast_gettext
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')"
# Pin rspec-puppet 2.6.9 until https://github.com/rodjek/rspec-puppet/issues/663 is fixed
- gem: 'rspec-puppet'
version: '2.6.9'

appveyor.yml:
unmanaged: true
Expand Down
31 changes: 20 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,26 @@ before_install:
matrix:
fast_finish: true
include:
- rvm: 2.4.1
env: CHECK="validate lint"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.8" FUTURE_PARSER="yes" CHECK=spec BEAKER_VERSION="3.0"
- rvm: 2.1.5
env: PUPPET_GEM_VERSION="~> 4.0.0" CHECK=spec BEAKER_VERSION="3.0"
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="4.7.1" HIERA_GEM_VERSION="3.2.2" CHECK=spec
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.10" CHECK=spec
- rvm: 2.4.1
- rvm: 2.5.3
env: CHECK="validate lint spec"
- rvm: 2.5.3
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=spec
- rvm: 2.3.8
env: PUPPET_GEM_VERSION="~> 4.10" CHECK=spec
# These cells test the task on different platforms
- rvm: 2.3.8
dist: trusty
env: GEM_BOLT=true BEAKER_debug=true BEAKER_set=docker/ubuntu-18.04
install: bundle install
script: cd task_spec && bundle exec rake task_acceptance
services: docker
sudo: required
- rvm: 2.3.8
dist: trusty
env: GEM_BOLT=true BEAKER_debug=true BEAKER_set=docker/centos-7
install: bundle install
script: cd task_spec && bundle exec rake task_acceptance
services: docker
sudo: required
notifications:
email: false
28 changes: 18 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,33 @@ minor_version = "#{ruby_version_segments[0]}.#{ruby_version_segments[1]}"
#end

group :development do
gem "puppet-module-posix-default-r#{minor_version}", :require => false, :platforms => "ruby"
gem "puppet-module-win-default-r#{minor_version}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "puppet-module-posix-dev-r#{minor_version}", '0.3.3', :require => false, :platforms => "ruby"
gem "puppet-module-win-dev-r#{minor_version}", '0.0.7', :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "json_pure", '<= 2.0.1', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "fast_gettext", '1.1.0', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "rspec-puppet", "2.6.9", :require => false
gem "puppet-module-posix-default-r#{minor_version}", :require => false, :platforms => "ruby"
gem "puppet-module-win-default-r#{minor_version}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', :require => false, :platforms => "ruby"
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.0.7', :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "json_pure", '<= 2.0.1', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "fast_gettext", '1.1.0', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
end

group :system_tests do
gem "puppet-module-posix-system-r#{minor_version}", :require => false, :platforms => "ruby"
gem "puppet-module-win-system-r#{minor_version}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '>= 3')
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 3.37')
gem "beaker-docker", '~> 0.3'
gem "beaker-vagrant", '~> 0.5'
gem "beaker-vmpooler", '~> 1.3'
gem "serverspec", '~> 2.39'
gem "beaker-pe", :require => false
gem "beaker-rspec", *location_for(ENV['BEAKER_RSPEC_VERSION'])
gem "beaker-rspec", *location_for(ENV['BEAKER_RSPEC_VERSION'] || '~> 6.2')
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'])
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')
gem "puppet-blacksmith", '~> 3.4', :require => false
# Bundler fails on 2.1.9 even though this group is excluded
if ENV['GEM_BOLT']
gem 'bolt', '~> 1.9', require: false
gem 'beaker-task_helper', '~> 1.5.2', require: false
end
end

gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'])
Expand Down
21 changes: 18 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@
* [Setup requirements](#setup-requirements)
* [Beginning with puppet_agent](#beginning-with-puppet_agent)
4. [Usage - Configuration options and additional functionality](#usage)
* [Puppet 3 Upgrades](#puppet-3-upgrades)
* [Puppet 4 Upgrades](#puppet-4-upgrades)
5. [Reference](#reference)
* [Public classes](#public-classes)
* [Private classes](#private-classes)
* [Parameters](#parameters)
* [Tasks](#tasks)
6. [Limitations - OS compatibility, etc.](#limitations)
* [Known issues](#known-issues)
7. [Development - Guide for contributing to the module](#development)

## Overview

A module for upgrading Puppet agents. Supports upgrading from Puppet 3 packages and puppet-agent packages, to puppet-agent packages (i.e. Puppet 4).
A module for upgrading Puppet agents. Supports upgrading from Puppet 4 puppet-agent packages to later versions.

## Module Description

Expand All @@ -31,8 +34,6 @@ If a package_version parameter is provided, it will ensure that puppet-agent ver

This module expects Puppet to be installed from packages.

Note: this is the last release that will support Puppet 3 and Ruby <2.1.

## Setup

### What puppet_agent affects
Expand Down Expand Up @@ -197,6 +198,20 @@ This is only applicable for Windows operating systems. There may be instances wh
msi_move_locked_files => true
```

### Tasks

#### `puppet_agent::version`

Checks for the version of puppet-agent package installed. Returns results as `{"version": "<ver>", "source": "<how version was
detected>"}`. If a version cannot be found, returns `{"version": null}`.

#### `puppet_agent::install`

Installs the puppet-agent package. Currently only supports Linux variants: Debian, Ubuntu, SLES, RHEL/CentOS/Fedora. A specific
package `version` can be specified; if not, will install or upgrade to the latest Puppet 5 version available.

**Note**: The `puppet_agent::install_shell` task requires the `facts::bash` implementation from the [facts](https://forge.puppet.com/puppetlabs/facts) module. Both the `puppet_agent` and `facts` modules are packaged with Bolt. For use outside of Bolt make sure the `facts` module is installed to the same `modules` directory as `puppet_agent`.

## Limitations

Mac OS X Open Source packages are currently not supported.
Expand Down
13 changes: 6 additions & 7 deletions files/solaris_start_puppet.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#!/bin/bash

puppet_pid=$1
shift
service_names=$*

while $(kill -0 ${puppet_pid:?}); do
sleep 5
done

function start_service() {
service="${1:?}"
/opt/puppetlabs/bin/puppet resource service "${service:?}" ensure=running enable=true
}

start_service puppet
start_service mcollective
for service_name in $service_names; do
/opt/puppetlabs/bin/puppet resource service "${service_name:?}" ensure=running enable=true
done
19 changes: 19 additions & 0 deletions lib/puppet/parser/functions/windows_msi_installargs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module Puppet::Parser::Functions
newfunction(:windows_msi_installargs, :arity => 1, :type => :rvalue, :doc => <<-EOS
Return the $install_options parameter as a string usable in an msiexec command
EOS
) do |args|

install_args = args[0]

arg_string = install_args.map do |option|
if option.class == Hash
key_value = option.shift
"#{key_value[0]}=\"#{key_value[1]}\""
else
option
end
end
return arg_string.join(' ')
end
end
17 changes: 9 additions & 8 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@
$msi_move_locked_files = false,
) inherits ::puppet_agent::params {

validate_re($arch, ['^x86$','^x64$','^i386$','^i86pc$','^amd64$','^x86_64$','^power$','^sun4[uv]$', '^ppc64le$', '^aarch64$', 'PowerPC_POWER'])

if $::osfamily == 'windows' and $install_dir != undef {
validate_absolute_path($install_dir)
}
Expand All @@ -93,9 +91,10 @@
$_expected_package_version = $package_version
}

$aio_upgrade_required = ($is_pe == false and $_expected_package_version != undef) or
(getvar('::aio_agent_version') != undef and $_expected_package_version != undef and
versioncmp("${::aio_agent_version}", "${_expected_package_version}") < 0)
$aio_upgrade_required = (getvar('::aio_agent_version') == undef) or
(getvar('::aio_agent_version') != undef and
$_expected_package_version != undef and
versioncmp("${::aio_agent_version}", "${_expected_package_version}") < 0)

if $::architecture == 'x86' and $arch == 'x64' {
fail('Unable to install x64 on a x86 system')
Expand Down Expand Up @@ -173,14 +172,16 @@
contain '::puppet_agent::prepare'
contain '::puppet_agent::install'

# On windows, our MSI handles the services
# On PE AIO nodes, PE Agent nodegroup is managing the services
# Service management:
# - Under Puppet Enterprise, the agent nodegroup is managed by PE, and we don't need to manage services here.
# - On Windows, services are handled by the puppet-agent MSI packages themselves.
# ...but outside of PE, on other platforms, we must make sure the services are restarted. We do that with the
# ::puppet_agent::service class. Make sure it's applied after the install process finishes if needed:
if $::osfamily != 'windows' and (!$is_pe or versioncmp($::clientversion, '4.0.0') < 0) {
class { '::puppet_agent::service':
require => Class['::puppet_agent::install'],
}
contain '::puppet_agent::service'
}

}
}
Loading