Skip to content

Commit

Permalink
Drop Puppet 5 support, require >= 6.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Feb 4, 2022
1 parent 4d279f1 commit 811d674
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 174 deletions.
17 changes: 8 additions & 9 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@
# $server_external_nodes:: External nodes classifier executable
#
# $server_trusted_external_command:: The external trusted facts script to use.
# (Puppet >= 6.11 only).
#
# $server_git_repo:: Use git repository as a source of modules
#
Expand Down Expand Up @@ -362,14 +361,14 @@
# $server_max_requests_per_instance:: Max number of requests a jruby instances will handle. Defaults to 0 (disabled)
#
# $server_max_queued_requests:: The maximum number of requests that may be queued waiting to borrow a
# JRuby from the pool. (Puppetserver 5.x only)
# Defaults to 0 (disabled) for Puppetserver >= 5.0
# JRuby from the pool.
# Defaults to 0 (disabled).
#
# $server_max_retry_delay:: Sets the upper limit for the random sleep set as a Retry-After header on
# 503 responses returned when max-queued-requests is enabled. (Puppetserver 5.x only)
# Defaults to 1800 for Puppetserver >= 5.0
# 503 responses returned when max-queued-requests is enabled.
# Defaults to 1800.
#
# $server_multithreaded:: Use multithreaded jruby. (Puppetserver >= 6.8 only). Defaults to false.
# $server_multithreaded:: Use multithreaded jruby. Defaults to false.
#
# $server_idle_timeout:: How long the server will wait for a response on an existing connection
#
Expand Down Expand Up @@ -451,9 +450,9 @@
# $server_metrics_allowed:: Specify metrics to allow in addition to those in the default list
# Defaults to undef
#
# $server_puppetserver_experimental:: For Puppetserver 5, enable the /puppet/experimental route? Defaults to true
# $server_puppetserver_experimental:: Enable the /puppet/experimental route? Defaults to true
#
# $server_puppetserver_auth_template:: Template for generating /etc/puppetlabs/puppetserver/conf.d/auth.conf
# $server_puppetserver_auth_template:: Template for generating /etc/puppetlabs/puppetserver/conf.d/auth.conf
#
# $server_puppetserver_trusted_agents:: Certificate names of puppet agents that are allowed to fetch *all* catalogs
# Defaults to [] and all agents are only allowed to fetch their own catalogs.
Expand Down Expand Up @@ -543,7 +542,7 @@
#
# class {'puppet':
# agent_noop => true,
# version => '6.11.0-1',
# version => '6.15.0-1',
# }
#
class puppet (
Expand Down
6 changes: 3 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@

$puppet_major = regsubst($::puppetversion, '^(\d+)\..*$', '\1')

if ($facts['os']['family'] =~ /(FreeBSD|DragonFly)/ and versioncmp($puppet_major, '5') >= 0) {
if ($facts['os']['family'] =~ /(FreeBSD|DragonFly)/) {
$server_package = "puppetserver${puppet_major}"
} else {
$server_package = undef
Expand Down Expand Up @@ -406,7 +406,7 @@

$server_puppetserver_version = undef

# Puppetserver 5.x Which auth.conf shall we use?
# Which auth.conf shall we use?
$server_use_legacy_auth_conf = false

# Puppetserver metrics shipping
Expand All @@ -418,7 +418,7 @@
$server_metrics_graphite_interval = 5
$server_metrics_allowed = undef

# For Puppetserver 5, should the /puppet/experimental route be enabled?
# Should the /puppet/experimental route be enabled?
$server_puppetserver_experimental = true

# For custom auth.conf settings allow passing in a template
Expand Down
21 changes: 8 additions & 13 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
# $external_nodes:: External nodes classifier executable
#
# $trusted_external_command:: The external trusted facts script to use.
# (Puppet >= 6.11 only).
#
# $git_repo:: Use git repository as a source of modules
#
Expand Down Expand Up @@ -194,14 +193,14 @@
# $max_requests_per_instance:: Max number of requests per jruby instance. Defaults to 0 (disabled)
#
# $max_queued_requests:: The maximum number of requests that may be queued waiting to borrow a
# JRuby from the pool. (Puppetserver 5.x only)
# Defaults to 0 (disabled) for Puppetserver >= 5.0
# JRuby from the pool.
# Defaults to 0 (disabled).
#
# $max_retry_delay:: Sets the upper limit for the random sleep set as a Retry-After header on
# 503 responses returned when max-queued-requests is enabled. (Puppetserver 5.x only)
# Defaults to 1800 for Puppetserver >= 5.0
# 503 responses returned when max-queued-requests is enabled.
# Defaults to 1800 for
#
# $multithreaded:: Use multithreaded jruby. (Puppetserver >= 6.8 only). Defaults to false.
# $multithreaded:: Use multithreaded jruby. Defaults to false.
#
# $idle_timeout:: How long the server will wait for a response on an existing connection
#
Expand Down Expand Up @@ -276,9 +275,9 @@
# $metrics_allowed:: Specify metrics to allow in addition to those in the default list
# Defaults to undef
#
# $puppetserver_experimental:: For Puppetserver 5, enable the /puppet/experimental route? Defaults to true
# $puppetserver_experimental:: Enable the /puppet/experimental route? Defaults to true
#
# $puppetserver_auth_template:: Template for generating /etc/puppetlabs/puppetserver/conf.d/auth.conf
# $puppetserver_auth_template:: Template for generating /etc/puppetlabs/puppetserver/conf.d/auth.conf
#
# $puppetserver_trusted_agents:: Certificate names of agents that are allowed to fetch *all* catalogs. Defaults to empty array
#
Expand Down Expand Up @@ -449,12 +448,8 @@
$real_puppetserver_version = $puppetserver_version
} elsif versioncmp($facts['puppetversion'], '7.0.0') >= 0 {
$real_puppetserver_version = '7.0.0'
} elsif versioncmp($facts['puppetversion'], '6.11.0') >= 0 {
$real_puppetserver_version = '6.11.0'
} elsif versioncmp($facts['puppetversion'], '6.0.0') >= 0 {
$real_puppetserver_version = '6.0.0'
} else {
$real_puppetserver_version = '5.3.6'
$real_puppetserver_version = '6.15.0'
}

if versioncmp($real_puppetserver_version, '7.0.0') >= 0 {
Expand Down
15 changes: 2 additions & 13 deletions manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
}

if $trusted_external_command {
if versioncmp($puppet::server::real_puppetserver_version, '6.11') < 0 {
fail('$server_trusted_external_command is only available for Puppet > 6.11')
}
puppet::config::master {
'trusted_external_command': value => $trusted_external_command,
}
Expand Down Expand Up @@ -157,17 +154,9 @@

# Generate a new CA and host cert if our host cert doesn't exist
if $puppet::server::ca {
if versioncmp($puppet::server::real_puppetserver_version, '6.0') > 0 {
$creates = $puppet::server::ssl_ca_cert
$command = "${puppet::puppetserver_cmd} ca setup"
} else {
$creates = $puppet::server::ssl_cert
$command = "${puppet::puppet_cmd} cert --generate ${puppet::server::certname} --allow-dns-alt-names"
}

exec {'puppet_server_config-generate_ca_cert':
creates => $creates,
command => $command,
creates => $puppet::server::ssl_ca_cert,
command => "${puppet::puppetserver_cmd} ca setup",
umask => '0022',
require => [
Concat["${puppet::server::dir}/puppet.conf"],
Expand Down
4 changes: 2 additions & 2 deletions manifests/server/puppetserver.pp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@
) {
include puppet::server

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

$puppetserver_package = pick($puppet::server::package, 'puppetserver')
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 5.5.8 < 8.0.0"
"version_requirement": ">= 6.15.0 < 8.0.0"
}
],
"operatingsystem_support": [
Expand Down
12 changes: 0 additions & 12 deletions spec/acceptance/puppetserver_latest_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,6 @@ class { 'puppet':
server => true,
server_max_open_files => 32143,
}
# Puppet 5 + puppet/systemd 3 workaround
# Also a possible systemd bug on Ubuntu 20.04
# https://github.com/theforeman/puppet-puppet/pull/779#issuecomment-886847275
if $puppet::server_max_open_files and (versioncmp($facts['puppetversion'], '6.1') < 0 or $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '20.04') {
exec { 'puppetserver-systemctl-daemon-reload':
command => 'systemctl daemon-reload',
refreshonly => true,
path => $facts['path'],
subscribe => File['/etc/systemd/system/puppetserver.service.d/limits.conf'],
}
}
MANIFEST
end
end
Expand Down
3 changes: 0 additions & 3 deletions spec/acceptance/puppetserver_upgrade_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
when 'puppet6'
from_version = '6.7.0'
to_version = '6.7.2'
when 'puppet5'
from_version = '5.3.6'
to_version = '5.3.7'
else
raise 'Unsupported Puppet collection'
end
Expand Down
Loading

0 comments on commit 811d674

Please sign in to comment.