42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,48 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [1.1.0]

### Summary
The addition of several OS support features and a considerable amount of compatibility and bug fixes.

### Known issues
While this release adds considerable features and bug fixes the following areas are known issues and require more work:
- For Windows, trigger an agent run after upgrade to get Puppet to create the nessesary directory structures.
- There is currently ongoing work to allow for upgrading from 2015.2.x to 2015.3.x.
- Solaris 11 support work is in progess, but currently still buggy.

### Features
- Adds support for SLES 10, Solaris 10, AIX.
- Add OSX 10.9 upgrades.
- Add no-internet Windows upgrade in PE.
- Added puppet_master_server fact.
- Adds `/opt/puppetlabs` to the managed directories.
- Additional test checks for /opt/puppetlabs.

### Bugfixes
- Use rspec expect syntax for catching errors.
- Base master_agent_version on pe_compiling_server_aio_build().
- Update in metadata to include support for SLES 10 and 11.
- Ensure pe-puppet/mcollective services stopped after removing the PUPpuppet and PUPmcollective packages.
- Small readme typo fix.
- Pass in Puppet agent PID as command line parameter to avoid recreating install_puppet.bat at every agent run.
- Allow using the internal mirror when resolving gems.
- Add Solaris 10 sparc to supported arch.
- No longer converts Windows file resource to RAL catalog.
- Create/use local_package_dir in params.pp.
- Fix behavior for non-PE.
- Fix specs for Windows changes.
- Remove check for null $service_names.
- Fix linter errors on Windows PR 66.
- Use common_appdata on Windows.
- Removes management of the puppet/mco services on Windows systems.
- Add start/wait to Windows upgrade.
- Pass in configured server to Windows MSI.
- Fixes SLES11 GPG key import issue.
- Fixed regex for SLES compatibility.
- Ensures local MSI package resource defined on Windows.

## [1.0.0] - 2015-07-28

### Summary
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'https://rubygems.org'
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

group :test do
gem 'rake', '~> 10.4'
Expand Down
7 changes: 6 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ The architecture version you wish to install. Defaults to `$::architecture`. Thi

The package to upgrade to, i.e., `puppet-agent`. Currently, the default and only accepted value is `puppet-agent`.

#####`service_name`
#####`service_names`

An array of services to start, normally `puppet` and `mcollective`. If the array is empty, no services are started.

Expand Down Expand Up @@ -112,6 +112,11 @@ In addition, there are several known issues with Windows:
* On Windows Server 2003, only x86 is supported, and the `arch` parameter is ignored. If you try to force an upgrade to x64, Puppet installs the x86 version with no error message.
* On Windows Server 2003 with Puppet Enterprise, the default download location is unreachable. You can work around this issue by specifying an alternate download URL in the `source` parameter.

Specifically in the 1.1.0 Release:
* For Windows, you must trigger an agent run after upgrading so that Puppet can create the necessary directory structures.
* Upgrading from 2015.2.x to 2015.3.x is not yet supported.
* Solaris 11 is not yet supported.

##Development

Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve.
Expand Down
6 changes: 6 additions & 0 deletions lib/facter/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
end
end

Facter.add('puppet_master_server') do
setcode do
Puppet.settings['server']
end
end

Facter.add('puppet_confdir') do
setcode do
Puppet.settings['confdir']
Expand Down
56 changes: 46 additions & 10 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
$source = $::puppet_agent::params::_source,
) inherits ::puppet_agent::params {

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

if versioncmp("${::clientversion}", '3.8.0') < 0 {
fail('upgrading requires Puppet 3.8')
Expand All @@ -33,18 +33,54 @@
if $::architecture == 'x86' and $arch == 'x64' {
fail('Unable to install x64 on a x86 system')
}
if $::osfamily == 'windows' {
class { '::puppet_agent::prepare': } ->
class { '::puppet_agent::windows::install': }

if $::operatingsystem == 'SLES' and $::operatingsystemmajrelease == '10' {
$_package_file_name = "${puppet_agent::package_name}-${puppet_agent::params::master_agent_version}-1.sles10.${::architecture}.rpm"
} elsif $::operatingsystem == 'Solaris' and $::operatingsystemmajrelease == '10' {
if $arch =~ /^sun4[uv]$/ {
$_package_file_name = "${puppet_agent::package_name}-${puppet_agent::params::master_agent_version}-1.sparc.pkg.gz"
} else {
$_package_file_name = "${puppet_agent::package_name}-${puppet_agent::params::master_agent_version}-1.i386.pkg.gz"
}
} elsif $::operatingsystem == 'Darwin' and $::macosx_productversion_major =~ /10\.[9,10,11]/ {
$_package_file_name = "${puppet_agent::package_name}-${puppet_agent::params::master_agent_version}-1.osx${$::macosx_productversion_major}.dmg"
} elsif $::operatingsystem == 'aix' and $::architecture =~ /PowerPC_POWER[5,6,7]/ {
$aix_ver_number = regsubst($::platform_tag,'aix-(\d+\.\d+)-power','\1')
$_package_file_name = "${puppet_agent::package_name}-${puppet_agent::params::master_agent_version}-1.aix${aix_ver_number}.ppc.rpm"
} elsif $::operatingsystem == 'Darwin' and $::macosx_productversion_major =~ /10\.[9,10,11]/ {
$_package_file_name = "${puppet_agent::package_name}-${puppet_agent::params::master_agent_version}-1.osx${$::macosx_productversion_major}.dmg"
} elsif $::osfamily == 'windows' {
$_arch = $::kernelmajversion ?{
/^5\.\d+/ => 'x86', # x64 is never allowed on windows 2003
default => $arch
}

if $is_pe {
$_package_file_name = "${package_name}-${_arch}.msi"
} else {
$_package_file_name = "${package_name}-${_arch}-latest.msi"
}
} else {
$_package_file_name = undef
}

class { '::puppet_agent::prepare':
package_file_name => $_package_file_name,
} ->
class { '::puppet_agent::install':
package_file_name => $_package_file_name,
}
else {
class { '::puppet_agent::prepare': } ->
class { '::puppet_agent::install': } ->
class { '::puppet_agent::service': }

contain '::puppet_agent::prepare'
contain '::puppet_agent::install'
contain '::puppet_agent::prepare'
contain '::puppet_agent::install'

# On windows, our MSI handles the services
if $::osfamily != 'windows' {
class { '::puppet_agent::service':
require => Class['::puppet_agent::install'],
}
contain '::puppet_agent::service'
}

}
}
65 changes: 62 additions & 3 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,69 @@
#
# This class is called from puppet_agent for install.
#
class puppet_agent::install {
# === Parameters
#
# [package_file_name]
# The puppet-agent package file name.
# (see puppet_agent::prepare::package_file_name)
#
class puppet_agent::install(
$package_file_name = undef,
) {
assert_private()

package { $::puppet_agent::package_name:
ensure => present,
if ($::operatingsystem == 'SLES' and $::operatingsystemmajrelease == '10') or ($::operatingsystem == 'AIX' and $::architecture =~ /PowerPC_POWER[5,6,7]/) {
contain puppet_agent::install::remove_packages

exec { 'replace puppet.conf removed by package removal':
path => '/bin:/usr/bin:/sbin:/usr/sbin',
command => "cp ${puppet_agent::params::confdir}/puppet.conf.rpmsave ${puppet_agent::params::config}",
creates => $puppet_agent::params::config,
require => Class['puppet_agent::install::remove_packages'],
before => Package[$puppet_agent::package_name],
logoutput => 'on_failure',
}

$_package_options = {
provider => 'rpm',
source => "/opt/puppetlabs/packages/${package_file_name}",
}
} elsif $::operatingsystem == 'Solaris' and $::operatingsystemmajrelease == '10' {
contain puppet_agent::install::remove_packages

$_unzipped_package_name = regsubst($package_file_name, '\.gz$', '')
$_package_options = {
adminfile => '/opt/puppetlabs/packages/solaris-noask',
source => "/opt/puppetlabs/packages/${_unzipped_package_name}",
require => Class['puppet_agent::install::remove_packages'],
}
} elsif $::operatingsystem == 'Darwin' and $::macosx_productversion_major =~ /10\.[9,10,11]/ {
contain puppet_agent::install::remove_packages

$_package_options = {
source => "/opt/puppetlabs/packages/${package_file_name}",
require => Class['puppet_agent::install::remove_packages'],
}
} else {
$_package_options = {}
}

if $::osfamily == 'windows' {
if $::puppet_agent::is_pe == true and empty($::puppet_agent::source) and defined(File["${::puppet_agent::params::local_packages_dir}/${package_file_name}"]) {
class { 'puppet_agent::windows::install':
package_file_name => $package_file_name,
source => windows_native_path("${::puppet_agent::params::local_packages_dir}/${package_file_name}"),
}
} else {
class { 'puppet_agent::windows::install':
package_file_name => $package_file_name,
source => $::puppet_agent::source,
}
}
} else {
package { $::puppet_agent::package_name:
ensure => present,
* => $_package_options,
}
}
}
83 changes: 83 additions & 0 deletions manifests/install/remove_packages.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# == Class puppet_agent::install::remove_packages
#
# This class is used in puppet_agent::install by platforms lacking a package
# manager, where we are required to manually remove the old pe-* packages prior
# to installing puppet-agent.
#
class puppet_agent::install::remove_packages {
assert_private()

if versioncmp("${::clientversion}", '4.0.0') < 0 {

if $::operatingsystem == 'Darwin' {

contain '::puppet_agent::install::remove_packages_osx'

} else {

$package_options = $::operatingsystem ? {
'SLES' => {
uninstall_options => '--nodeps',
provider => 'rpm',
},
'AIX' => {
uninstall_options => '--nodeps',
provider => 'rpm',
},
'Solaris' => {
adminfile => '/opt/puppetlabs/packages/solaris-noask',
},
default => {
}
}

$packages = $::operatingsystem ? {
'Solaris' => [
'PUPpuppet',
'PUPaugeas',
'PUPdeep-merge',
'PUPfacter',
'PUPhiera',
'PUPlibyaml',
'PUPmcollective',
'PUPopenssl',
'PUPpuppet-enterprise-release',
'PUPruby',
'PUPruby-augeas',
'PUPruby-rgen',
'PUPruby-shadow',
'PUPstomp',
],
default => [
'pe-augeas',
'pe-mcollective-common',
'pe-rubygem-deep-merge',
'pe-mcollective',
'pe-puppet-enterprise-release',
'pe-libldap',
'pe-libyaml',
'pe-ruby-stomp',
'pe-ruby-augeas',
'pe-ruby-shadow',
'pe-hiera',
'pe-facter',
'pe-puppet',
'pe-openssl',
'pe-ruby',
'pe-ruby-rgen',
'pe-virt-what',
'pe-ruby-ldap',
]
}

# We only need to remove these packages if we are transitioning from PE
# versions that are pre AIO.
$packages.each |$old_package| {
package { $old_package:
ensure => absent,
* => $package_options,
}
}
}
}
}
60 changes: 60 additions & 0 deletions manifests/install/remove_packages_osx.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# == Class puppet_agent::install::remove_packages_osx
#
# Sadly, special handling is required to clear up puppet_enterprise installation
# on 3.8.
#
class puppet_agent::install::remove_packages_osx {
assert_private()

if $::puppet_agent::is_pe {
# shutdown services
service { 'pe-puppet':
ensure => stopped,
}->
service { 'pe-mcollective':
ensure => stopped,
}->

# remove old users and groups
user { 'pe-puppet':
ensure => absent,
}->
user { 'pe-mcollective':
ensure => absent,
}->

# remove old /opt/puppet files
file { '/opt/puppet':
ensure => absent,
force => true,
backup => false,
}
# Can't delete /var/opt/lib/pe-puppet or we get errors because
# /var/opt/lib/pe-puppet/state is missing when puppet run tries to save
# report

# forget packages
[
'pe-augeas',
'pe-ruby-augeas',
'pe-openssl',
'pe-ruby',
'pe-cfpropertylist',
'pe-facter',
'pe-puppet',
'pe-mcollective',
'pe-hiera',
'pe-puppet-enterprise-release',
'pe-stomp',
'pe-libyaml',
'pe-ruby-rgen',
'pe-deep-merge',
'pe-ruby-shadow',
].each |$package| {
exec { "forget ${package}":
command => "/usr/sbin/pkgutil --forget com.puppetlabs.${package}",
require => File['/opt/puppet'],
}
}
}
}
16 changes: 16 additions & 0 deletions manifests/osfamily/aix.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class puppet_agent::osfamily::aix(
$package_file_name = undef,
) {
assert_private()

class { 'puppet_agent::prepare::package':
package_file_name => $package_file_name,
}

contain puppet_agent::prepare::package

file { '/usr/local/bin/puppet':
ensure => 'link',
target => '/opt/puppetlabs/bin/puppet',
}
}
Loading