Skip to content

Commit

Permalink
Drop Apache 2.2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Dec 14, 2022
1 parent 08ed7f8 commit cedd45b
Show file tree
Hide file tree
Showing 72 changed files with 277 additions and 1,689 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
[aliased servers]: https://httpd.apache.org/docs/current/urlmapping.html
[`AllowEncodedSlashes`]: https://httpd.apache.org/docs/current/mod/core.html#allowencodedslashes
[`apache`]: https://forge.puppet.com/modules/puppetlabs/apache/reference#apache
[`apache_version`]: https://forge.puppet.com/modules/puppetlabs/apache/reference#apache_version
[`apache::balancer`]: https://forge.puppet.com/modules/puppetlabs/apache/reference#apachebalancer
[`apache::balancermember`]: https://forge.puppet.com/modules/puppetlabs/apache/reference#apachebalancermember
[`apache::mod`]: https://forge.puppet.com/modules/puppetlabs/apache/reference#apachemod
Expand Down
29 changes: 0 additions & 29 deletions lib/facter/apache_version.rb

This file was deleted.

14 changes: 6 additions & 8 deletions manifests/balancer.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@
) {
include apache::mod::proxy_balancer

if versioncmp($apache::mod::proxy_balancer::apache_version, '2.4') >= 0 {
$lbmethod = $proxy_set['lbmethod'] ? {
undef => 'byrequests',
default => $proxy_set['lbmethod'],
}
ensure_resource('apache::mod', "lbmethod_${lbmethod}", {
'loadfile_name' => "proxy_balancer_lbmethod_${lbmethod}.load"
})
$lbmethod = $proxy_set['lbmethod'] ? {
undef => 'byrequests',
default => $proxy_set['lbmethod'],
}
ensure_resource('apache::mod', "lbmethod_${lbmethod}", {
'loadfile_name' => "proxy_balancer_lbmethod_${lbmethod}.load"
})

if $target {
$_target = $target
Expand Down
77 changes: 26 additions & 51 deletions manifests/default_mods.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
class apache::default_mods (
Boolean $all = true,
Optional[Variant[Array[String], String]] $mods = undef,
String $apache_version = $apache::apache_version,
Boolean $use_systemd = $apache::use_systemd,
) {
# These are modules required to run the default configuration.
Expand All @@ -14,19 +13,13 @@
case $facts['os']['family'] {
'redhat': {
::apache::mod { 'log_config': }
if versioncmp($apache_version, '2.4') >= 0 {
# Lets fork it
# Do not try to load mod_systemd on RHEL/CentOS 6 SCL.
if ( !($facts['os']['family'] == 'redhat' and versioncmp($facts['os']['release']['major'], '7') == -1) and !($facts['os']['name'] == 'Amazon') ) {
if ($use_systemd) {
::apache::mod { 'systemd': }
}
}
if ($facts['os']['name'] == 'Amazon' and $facts['os']['release']['full'] == '2') {
::apache::mod { 'systemd': }
}
::apache::mod { 'unixd': }
if $facts['os']['name'] != 'Amazon' and $use_systemd {
::apache::mod { 'systemd': }
}
if ($facts['os']['name'] == 'Amazon' and $facts['os']['release']['full'] == '2') {
::apache::mod { 'systemd': }
}
::apache::mod { 'unixd': }
}
'freebsd': {
::apache::mod { 'log_config': }
Expand All @@ -49,9 +42,6 @@
'debian': {
include apache::mod::authn_core
include apache::mod::reqtimeout
if versioncmp($apache_version, '2.4') < 0 {
::apache::mod { 'authn_alias': }
}
}
'redhat': {
include apache::mod::actions
Expand All @@ -63,7 +53,6 @@
include apache::mod::rewrite
include apache::mod::speling
include apache::mod::suexec
include apache::mod::version
include apache::mod::vhost_alias
::apache::mod { 'auth_digest': }
::apache::mod { 'authn_anon': }
Expand All @@ -75,11 +64,6 @@
::apache::mod { 'logio': }
::apache::mod { 'substitute': }
::apache::mod { 'usertrack': }

if versioncmp($apache_version, '2.4') < 0 {
::apache::mod { 'authn_alias': }
::apache::mod { 'authn_default': }
}
}
'freebsd': {
include apache::mod::actions
Expand All @@ -92,7 +76,6 @@
include apache::mod::reqtimeout
include apache::mod::rewrite
include apache::mod::userdir
include apache::mod::version
include apache::mod::vhost_alias
include apache::mod::speling
include apache::mod::filter
Expand Down Expand Up @@ -141,45 +124,37 @@
include apache::mod::setenvif
include apache::mod::auth_basic

if versioncmp($apache_version, '2.4') >= 0 {
# filter is needed by mod_deflate
include apache::mod::filter
# filter is needed by mod_deflate
include apache::mod::filter

# authz_core is needed for 'Require' directive
::apache::mod { 'authz_core':
id => 'authz_core_module',
}

# lots of stuff seems to break without access_compat
::apache::mod { 'access_compat': }
} else {
include apache::mod::authz_default
# authz_core is needed for 'Require' directive
::apache::mod { 'authz_core':
id => 'authz_core_module',
}

# lots of stuff seems to break without access_compat
::apache::mod { 'access_compat': }

include apache::mod::authz_user
include apache::mod::authz_groupfile
include apache::mod::env
} elsif $mods {
::apache::default_mods::load { $mods: }

if versioncmp($apache_version, '2.4') >= 0 {
# authz_core is needed for 'Require' directive
::apache::mod { 'authz_core':
id => 'authz_core_module',
}

# filter is needed by mod_deflate
include apache::mod::filter
# authz_core is needed for 'Require' directive
::apache::mod { 'authz_core':
id => 'authz_core_module',
}
} else {
if versioncmp($apache_version, '2.4') >= 0 {
# authz_core is needed for 'Require' directive
::apache::mod { 'authz_core':
id => 'authz_core_module',
}

# filter is needed by mod_deflate
include apache::mod::filter
# filter is needed by mod_deflate
include apache::mod::filter
} else {
# authz_core is needed for 'Require' directive
::apache::mod { 'authz_core':
id => 'authz_core_module',
}

# filter is needed by mod_deflate
include apache::mod::filter
}
}
26 changes: 2 additions & 24 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
# responses to URLs containing '\' and '/' characters. If not specified, this parameter omits
# the declaration from the server's configuration and uses Apache's default setting of 'off'.
#
# @param apache_version
# Configures module template behavior, package names, and default Apache modules by defining
# the version of Apache to use. We do not recommend manually configuring this parameter
# without reason.
#
# @param conf_dir
# Sets the directory where the Apache server's main configuration file is located.
#
Expand Down Expand Up @@ -48,7 +43,7 @@
# on your operating system, and you can declare any other modules separately using the
# `apache::mod::<MODULE NAME>` class or `apache::mod` defined type.<br />
# If `true`, Puppet installs additional modules, depending on the operating system and
# the values of `apache_version` and `mpm_module` parameters. Because these lists of
# the value of the `mpm_module` parameter. Because these lists of
# modules can change frequently, consult the Puppet module's code for up-to-date lists.<br />
# If this parameter contains an array, Puppet instead enables all passed Apache modules.
#
Expand Down Expand Up @@ -307,11 +302,6 @@
# Setting `purge_vhost_dir` to `false` is a stopgap measure to allow the apache module to
# coexist with existing or otherwise unmanaged configurations within `vhost_dir`.
#
# @param rewrite_lock
# Allows setting a custom location for a rewrite lock - considered best practice if using
# a RewriteMap of type prg in the `rewrites` parameter of your virtual host. This parameter
# only applies to Apache version 2.2 or lower and is ignored on newer versions.
#
# @param sendfile
# Forces Apache to use the Linux kernel's `sendfile` support to serve static files, via the
# `EnableSendfile` directive.
Expand Down Expand Up @@ -512,12 +502,11 @@
String $vhost_include_pattern = $apache::params::vhost_include_pattern,
Stdlib::Absolutepath $mod_dir = $apache::params::mod_dir,
Optional[Stdlib::Absolutepath] $mod_enable_dir = $apache::params::mod_enable_dir,
Variant[Boolean, String] $mpm_module = $apache::params::mpm_module,
Variant[Boolean, Enum['event', 'itk', 'peruser', 'prefork', 'worker']] $mpm_module = $apache::params::mpm_module,
String $lib_path = $apache::params::lib_path,
String $conf_template = $apache::params::conf_template,
Optional[String] $servername = $apache::params::servername,
String $pidfile = $apache::params::pidfile,
Optional[Stdlib::Absolutepath] $rewrite_lock = undef,
Boolean $manage_user = true,
Boolean $manage_group = true,
String $user = $apache::params::user,
Expand All @@ -537,7 +526,6 @@
Optional[String] $ssl_file = undef,
Stdlib::Absolutepath $ports_file = $apache::params::ports_file,
Stdlib::Absolutepath $docroot = $apache::params::docroot,
String $apache_version = $apache::version::default,
Apache::ServerTokens $server_tokens = 'Prod',
Variant[Enum['On', 'Off'], String] $server_signature = 'On',
Enum['On', 'Off', 'extended'] $trace_enable = 'On',
Expand All @@ -557,11 +545,6 @@
Array[Enum['h2', 'h2c', 'http/1.1']] $protocols = [],
Optional[Boolean] $protocols_honor_order = undef,
) inherits apache::params {
$valid_mpms_re = $apache_version ? {
'2.4' => '(event|itk|peruser|prefork|worker)',
default => '(event|itk|prefork|worker)'
}

if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7' {
# On redhat 7 the ssl.conf lives in /etc/httpd/conf.d (the confd_dir)
# when all other module configs live in /etc/httpd/conf.modules.d (the
Expand All @@ -578,10 +561,6 @@
}
}

if $mpm_module and $mpm_module != 'false' { # lint:ignore:quoted_booleans
assert_type(Pattern[$valid_mpms_re], $mpm_module)
}

# NOTE: on FreeBSD it's mpm module's responsibility to install httpd package.
# NOTE: the same strategy may be introduced for other OSes. For this, you
# should delete the 'if' block below and modify all MPM modules' manifests
Expand Down Expand Up @@ -802,7 +781,6 @@
# - $server_tokens
# - $server_signature
# - $trace_enable
# - $rewrite_lock
# - $root_directory_secured
file { "${apache::conf_dir}/${apache::params::conf_file}":
ensure => file,
Expand Down
7 changes: 1 addition & 6 deletions manifests/mod.pp
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,7 @@
if $package {
$_package = $package
} elsif has_key($mod_packages, $mod) { # 2.6 compatibility hack
if ($apache::apache_version == '2.4' and $facts['os']['name'] =~ /^[Aa]mazon$/ and $facts['os']['release']['major'] != '2') {
# On amazon linux we need to prefix our package name with mod24 instead of mod to support apache 2.4
$_package = regsubst($mod_packages[$mod],'^(mod_)?(.*)','mod24_\2')
} else {
$_package = $mod_packages[$mod]
}
$_package = $mod_packages[$mod]
} else {
$_package = undef
}
Expand Down
7 changes: 1 addition & 6 deletions manifests/mod/alias.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# @summary
# Installs and configures `mod_alias`.
#
# @param apache_version
# The version of Apache, if not set will be retrieved from the init class.
#
# @param icons_options
# Disables directory listings for the icons directory, via Apache [Options](https://httpd.apache.org/docs/current/mod/core.html#options)
# directive.
Expand All @@ -22,17 +19,15 @@
# @see https://httpd.apache.org/docs/current/mod/mod_alias.html for additional documentation.
#
class apache::mod::alias (
Optional[String] $apache_version = undef,
String $icons_options = 'Indexes MultiViews',
# set icons_path to false to disable the alias
Variant[Boolean, Stdlib::Absolutepath] $icons_path = $apache::params::alias_icons_path,
String $icons_prefix = $apache::params::icons_prefix
) inherits apache::params {
include apache
$_apache_version = pick($apache_version, $apache::apache_version)
apache::mod { 'alias': }

# Template uses $icons_path, $_apache_version
# Template uses $icons_path
if $icons_path {
file { 'alias.conf':
ensure => file,
Expand Down
11 changes: 2 additions & 9 deletions manifests/mod/authn_core.pp
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# @summary
# Installs `mod_authn_core`.
#
# @param apache_version
# The version of apache being run.
#
# @see https://httpd.apache.org/docs/current/mod/mod_authn_core.html for additional documentation.
#
class apache::mod::authn_core (
Optional[String] $apache_version = $apache::apache_version
) {
if versioncmp($apache_version, '2.4') >= 0 {
::apache::mod { 'authn_core': }
}
class apache::mod::authn_core {
::apache::mod { 'authn_core': }
}
17 changes: 0 additions & 17 deletions manifests/mod/authz_default.pp

This file was deleted.

11 changes: 1 addition & 10 deletions manifests/mod/data.pp
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
# @summary
# Installs and configures `mod_data`.
#
# @param apache_version
# Version of Apache to install module on.
#
# @see https://httpd.apache.org/docs/current/mod/mod_data.html for additional documentation.
#
class apache::mod::data (
Optional[String] $apache_version = undef,
) {
class apache::mod::data {
include apache
$_apache_version = pick($apache_version, $apache::apache_version)
if versioncmp($_apache_version, '2.3') < 0 {
fail('mod_data is only available in Apache 2.3 and later')
}
::apache::mod { 'data': }
}
Loading

0 comments on commit cedd45b

Please sign in to comment.