|
18 | 18 | ) {
|
19 | 19 | assert_private()
|
20 | 20 |
|
21 |
| - $old_packages = (versioncmp("${::clientversion}", '4.0.0') < 0) |
22 | 21 | $pa_collection = getvar('::puppet_agent::collection')
|
23 | 22 |
|
24 | 23 | if ($::operatingsystem == 'SLES' and $::operatingsystemmajrelease == '10') or $::operatingsystem == 'AIX' {
|
|
27 | 26 | default => $install_options
|
28 | 27 | }
|
29 | 28 |
|
30 |
| - if $old_packages { |
31 |
| - contain puppet_agent::install::remove_packages |
32 |
| - |
33 |
| - exec { 'replace puppet.conf removed by package removal': |
34 |
| - path => '/bin:/usr/bin:/sbin:/usr/sbin', |
35 |
| - command => "cp ${puppet_agent::params::confdir}/puppet.conf.rpmsave ${puppet_agent::params::config}", |
36 |
| - creates => $puppet_agent::params::config, |
37 |
| - require => Class['puppet_agent::install::remove_packages'], |
38 |
| - before => Package[$puppet_agent::package_name], |
39 |
| - logoutput => 'on_failure', |
40 |
| - } |
41 |
| - |
42 |
| - # package provider does not provide 'versionable' |
43 |
| - $ensure = 'present' |
44 |
| - } else { |
45 |
| - $ensure = $package_version |
46 |
| - } |
47 | 29 |
|
48 | 30 | package { $::puppet_agent::package_name:
|
49 |
| - ensure => $ensure, |
| 31 | + ensure => $package_version, |
50 | 32 | provider => 'rpm',
|
51 | 33 | source => "/opt/puppetlabs/packages/${package_file_name}",
|
52 | 34 | install_options => $_install_options,
|
53 | 35 | }
|
54 | 36 | } elsif $::operatingsystem == 'Solaris' and $::operatingsystemmajrelease == '10' {
|
55 | 37 | $_unzipped_package_name = regsubst($package_file_name, '\.gz$', '')
|
| 38 | + $install_script = 'solaris_install.sh.erb' |
| 39 | + |
| 40 | + # The following are expected to be available in the solaris_install.sh.erb template: |
56 | 41 | $adminfile = '/opt/puppetlabs/packages/solaris-noask'
|
57 | 42 | $sourcefile = "/opt/puppetlabs/packages/${_unzipped_package_name}"
|
58 |
| - $install_script = 'solaris_install.sh.erb' |
59 | 43 |
|
60 | 44 | # Puppet prior to 5.0 would not use a separate process contract when forking from the Puppet
|
61 | 45 | # service. That resulted in service-initiated upgrades failing because trying to remove or
|
62 | 46 | # upgrade the package would stop the service, thereby killing the Puppet run. Use a script
|
63 | 47 | # to perform the upgrade after Puppet is done running.
|
64 | 48 | # Puppet 5.0 adds this, but some i18n implementation is loading code fairly late and appears
|
65 | 49 | # to be messing up the upgrade.
|
66 |
| - if $old_packages or $puppet_agent::aio_upgrade_required { |
67 |
| - $old_package_names = $old_packages ? { |
68 |
| - true => [ |
69 |
| - 'PUPpuppet', |
70 |
| - 'PUPaugeas', |
71 |
| - 'PUPdeep-merge', |
72 |
| - 'PUPfacter', |
73 |
| - 'PUPhiera', |
74 |
| - 'PUPlibyaml', |
75 |
| - 'PUPmcollective', |
76 |
| - 'PUPopenssl', |
77 |
| - 'PUPpuppet-enterprise-release', |
78 |
| - 'PUPruby', |
79 |
| - 'PUPruby-augeas', |
80 |
| - 'PUPruby-rgen', |
81 |
| - 'PUPruby-shadow', |
82 |
| - 'PUPstomp', |
83 |
| - ], |
84 |
| - default => ['puppet-agent'], |
85 |
| - } |
86 | 50 |
|
| 51 | + if $puppet_agent::aio_upgrade_required { |
87 | 52 | $_logfile = "${::env_temp_variable}/solaris_install.log"
|
88 | 53 | notice ("Puppet install log file at ${_logfile}")
|
89 | 54 |
|
|
97 | 62 | command => "/usr/bin/ctrun -l none ${_installsh} ${::puppet_agent_pid} 2>&1 > ${_logfile} &",
|
98 | 63 | }
|
99 | 64 | }
|
100 |
| - } elsif $::operatingsystem == 'Solaris' and $::operatingsystemmajrelease == '11' and $old_packages { |
101 |
| - # Updating from PE 3.x requires removing all the old packages before installing the puppet-agent package. |
102 |
| - # After puppet-agent is installed, we can use 'pkg update' for future upgrades. |
103 |
| - contain puppet_agent::install::remove_packages |
104 |
| - |
105 |
| - exec { 'puppet_agent restore /etc/puppetlabs': |
106 |
| - command => 'cp -r /tmp/puppet_agent/puppetlabs /etc', |
107 |
| - path => '/bin:/usr/bin:/sbin:/usr/sbin', |
108 |
| - require => Class['puppet_agent::install::remove_packages'], |
109 |
| - } |
110 |
| - |
111 |
| - package { $::puppet_agent::package_name: |
112 |
| - ensure => 'present', |
113 |
| - require => Exec['puppet_agent restore /etc/puppetlabs'], |
114 |
| - notify => Exec['puppet_agent post-install restore /etc/puppetlabs'], |
115 |
| - install_options => $install_options, |
116 |
| - } |
117 |
| - |
118 |
| - exec { 'puppet_agent post-install restore /etc/puppetlabs': |
119 |
| - command => 'cp -r /tmp/puppet_agent/puppetlabs /etc', |
120 |
| - path => '/bin:/usr/bin:/sbin:/usr/sbin', |
121 |
| - refreshonly => true, |
122 |
| - } |
123 | 65 | } elsif $::operatingsystem == 'Darwin' and $::macosx_productversion_major =~ /^10\.(9|10|11|12|13)/ {
|
124 |
| - if $old_packages or $puppet_agent::aio_upgrade_required { |
| 66 | + if $puppet_agent::aio_upgrade_required { |
125 | 67 | $install_script = 'osx_install.sh.erb'
|
126 | 68 |
|
127 |
| - contain puppet_agent::install::remove_packages |
128 |
| - |
129 | 69 | $_logfile = "${::env_temp_variable}/osx_install.log"
|
130 | 70 | notice("Puppet install log file at ${_logfile}")
|
131 | 71 |
|
132 | 72 | $_installsh = "${::env_temp_variable}/osx_install.sh"
|
133 | 73 | file { "${_installsh}":
|
134 | 74 | ensure => file,
|
135 | 75 | mode => '0755',
|
136 |
| - content => template('puppet_agent/do_install.sh.erb'), |
137 |
| - require => Class['Puppet_agent::Install::Remove_packages'] |
| 76 | + content => template('puppet_agent/do_install.sh.erb') |
138 | 77 | }
|
139 | 78 | -> exec { 'osx_install script':
|
140 | 79 | command => "${_installsh} ${::puppet_agent_pid} 2>&1 > ${_logfile} &",
|
141 | 80 | }
|
142 | 81 | }
|
143 | 82 | } elsif $::osfamily == 'windows' {
|
144 | 83 | # Prevent re-running the batch install
|
145 |
| - if $old_packages or $puppet_agent::aio_upgrade_required { |
| 84 | + if $puppet_agent::aio_upgrade_required { |
146 | 85 | if $::puppet_agent::is_pe == true and empty($::puppet_agent::source) {
|
147 | 86 | $local_package_file_path = windows_native_path("${::puppet_agent::params::local_packages_dir}/${package_file_name}")
|
148 | 87 | class { 'puppet_agent::windows::install':
|
|
0 commit comments