Skip to content

Commit

Permalink
Drop puppetserver < 2.7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Nov 2, 2018
1 parent c76955c commit ad4643a
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 230 deletions.
92 changes: 16 additions & 76 deletions manifests/server/puppetserver.pp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@
) {
include ::puppet::server

if versioncmp($server_puppetserver_version, '2.2') < 0 {
fail('puppetserver <2.2 is not supported by this module version')
if versioncmp($server_puppetserver_version, '2.7') < 0 {
fail('puppetserver <2.7 is not supported by this module version')
}

if !(empty($server_http_allow)) {
Expand Down Expand Up @@ -165,13 +165,7 @@
changes => $changes,
}

if versioncmp($server_puppetserver_version, '2.4.99') == 0 {
$bootstrap_paths = "${server_puppetserver_dir}/bootstrap.cfg,${server_puppetserver_dir}/services.d/,/opt/puppetlabs/server/apps/puppetserver/config/services.d/"
} elsif versioncmp($server_puppetserver_version, '2.5') >= 0 {
$bootstrap_paths = "${server_puppetserver_dir}/services.d/,/opt/puppetlabs/server/apps/puppetserver/config/services.d/"
} else { # 2.4
$bootstrap_paths = "${server_puppetserver_dir}/bootstrap.cfg"
}
$bootstrap_paths = "${server_puppetserver_dir}/services.d/,/opt/puppetlabs/server/apps/puppetserver/config/services.d/"

if versioncmp($server_puppetserver_version, '5.3') >= 0 {
$server_gem_paths = [ '${jruby-puppet.gem-home}', "\"${server_puppetserver_vardir}/vendored-jruby-gems\"", "\"/opt/puppetlabs/puppet/lib/ruby/vendor_gems\""] # lint:ignore:single_quote_string_with_variables
Expand Down Expand Up @@ -201,69 +195,21 @@
}
}

# 2.4.99 configures for both 2.4 and 2.5 making upgrades and new installations easier when the
# precise version available isn't known
if versioncmp($server_puppetserver_version, '2.4.99') >= 0 {
$servicesd = "${server_puppetserver_dir}/services.d"
file { $servicesd:
ensure => directory,
}
file { "${servicesd}/ca.cfg":
ensure => file,
content => template('puppet/server/puppetserver/services.d/ca.cfg.erb'),
}

unless $::osfamily == 'FreeBSD' {
file { '/opt/puppetlabs/server/apps/puppetserver/config':
ensure => directory,
}
file { '/opt/puppetlabs/server/apps/puppetserver/config/services.d':
ensure => directory,
}
}
$servicesd = "${server_puppetserver_dir}/services.d"
file { $servicesd:
ensure => directory,
}
file { "${servicesd}/ca.cfg":
ensure => file,
content => template('puppet/server/puppetserver/services.d/ca.cfg.erb'),
}

if versioncmp($server_puppetserver_version, '2.5') < 0 {
$bootstrapcfg = "${server_puppetserver_dir}/bootstrap.cfg"
file { $bootstrapcfg:
ensure => file,
}

$ca_enabled_ensure = $server_ca ? {
true => present,
default => absent,
}

$ca_disabled_ensure = $server_ca ? {
false => present,
default => absent,
}

file_line { 'ca_enabled':
ensure => $ca_enabled_ensure,
path => $bootstrapcfg,
line => 'puppetlabs.services.ca.certificate-authority-service/certificate-authority-service',
require => File[$bootstrapcfg],
}

file_line { 'ca_disabled':
ensure => $ca_disabled_ensure,
path => $bootstrapcfg,
line => 'puppetlabs.services.ca.certificate-authority-disabled-service/certificate-authority-disabled-service',
require => File[$bootstrapcfg],
}

if versioncmp($server_puppetserver_version, '2.3') >= 0 {
$versioned_code_service_ensure = present
} else {
$versioned_code_service_ensure = absent
unless $::osfamily == 'FreeBSD' {
file { '/opt/puppetlabs/server/apps/puppetserver/config':
ensure => directory,
}

file_line { 'versioned_code_service':
ensure => $versioned_code_service_ensure,
path => $bootstrapcfg,
line => 'puppetlabs.services.versioned-code-service.versioned-code-service/versioned-code-service',
require => File[$bootstrapcfg],
file { '/opt/puppetlabs/server/apps/puppetserver/config/services.d':
ensure => directory,
}
}

Expand All @@ -286,14 +232,8 @@
content => template('puppet/server/puppetserver/conf.d/webserver.conf.erb'),
}

if versioncmp($server_puppetserver_version, '2.7') >= 0 {
$product_conf_ensure = file
} else {
$product_conf_ensure = absent
}

file { "${server_puppetserver_dir}/conf.d/product.conf":
ensure => $product_conf_ensure,
ensure => file,
content => template('puppet/server/puppetserver/conf.d/product.conf.erb'),
}

Expand Down
10 changes: 5 additions & 5 deletions spec/acceptance/puppetserver_upgrade_2_6_0_to_2_7_2_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper_acceptance'

describe 'Scenario: 2.6.0 to 2.7.2 upgrade:' do
describe 'Scenario: 2.7.0 to 2.7.2 upgrade:', when: ENV['BEAKER_PUPPET_COLLECTION'] == 'pc1' do
before(:context) do
if check_for_package(default, 'puppetserver')
on default, puppet('resource package puppetserver ensure=purged')
Expand All @@ -15,14 +15,14 @@

case fact('osfamily')
when 'Debian'
from_version = '2.6.0-1puppetlabs1'
from_version = '2.7.0-1puppetlabs1'
to_version = '2.7.2-1puppetlabs1'
else
from_version = '2.6.0'
from_version = '2.7.0'
to_version = '2.7.2'
end

context 'install 2.6.0' do
context 'install 2.7.0' do
let(:pp) do
<<-EOS
class { '::puppet':
Expand All @@ -42,7 +42,7 @@ class { '::puppet':
it_behaves_like 'a idempotent resource'

describe command('puppetserver --version') do
its(:stdout) { is_expected.to match("puppetserver version: 2.6.0\n") }
its(:stdout) { is_expected.to match("puppetserver version: 2.7.0\n") }
end

describe service('puppetserver') do
Expand Down
Loading

0 comments on commit ad4643a

Please sign in to comment.