Skip to content

Commit 2757c3a

Browse files
committed
Drop support for Debian < 9 and Ubuntu < 16.04
1 parent 0cead10 commit 2757c3a

File tree

5 files changed

+59
-146
lines changed

5 files changed

+59
-146
lines changed

manifests/mod/suphp.pp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
#
66
class apache::mod::suphp (
77
) {
8-
if ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '15.10') >= 0) or
9-
($facts['os']['name'] == 'Debian' and versioncmp($::operatingsystemrelease, '8') >= 0) {
8+
if $facts['os']['family'] == 'Debian' {
109
fail("suphp was declared EOL by it's creators as of 2013 and so is no longer supported on Ubuntu 15.10/Debian 8 and above. Please use php-fpm")
1110
}
1211
include apache

manifests/mpm.pp

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,33 +84,28 @@
8484
}
8585
}
8686

87-
if $mpm == 'itk' {
88-
if ( ( $::operatingsystem == 'Ubuntu' ) or ( ($::operatingsystem == 'Debian') and ( versioncmp($::operatingsystemrelease, '8.0.0') >= 0 ) ) ) {
87+
case $mpm {
88+
'itk': {
8989
include apache::mpm::disable_mpm_event
9090
include apache::mpm::disable_mpm_worker
91-
}
9291

93-
package { 'libapache2-mpm-itk':
94-
ensure => present,
95-
before => [
96-
Class['apache::service'],
97-
File[$apache::mod_enable_dir],
98-
],
92+
package { 'libapache2-mpm-itk':
93+
ensure => present,
94+
before => [
95+
Class['apache::service'],
96+
File[$apache::mod_enable_dir],
97+
],
98+
}
9999
}
100-
}
101-
102-
if $mpm == 'prefork' {
103-
if ( ( $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease,'18.04') >= 0 ) or ( $::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '8.0.0') >= 0 ) ) {
100+
'prefork': {
104101
include apache::mpm::disable_mpm_event
105102
include apache::mpm::disable_mpm_worker
106103
}
107-
}
108-
109-
if $mpm == 'worker' {
110-
if ( ( $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease,'18.04') >= 0 ) or ( $::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '8.0.0') >= 0 ) ) {
104+
'worker': {
111105
include apache::mpm::disable_mpm_event
112106
include apache::mpm::disable_mpm_prefork
113107
}
108+
default: {}
114109
}
115110
}
116111

manifests/params.pp

Lines changed: 42 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -358,79 +358,46 @@
358358
$suphp_addhandler = 'x-httpd-php'
359359
$suphp_engine = 'off'
360360
$suphp_configpath = '/etc/php5/apache2'
361-
if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') < 0) or ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '9') < 0) {
362-
# Only the major version is used here
363-
$php_version = '5'
364-
$mod_packages = {
365-
'auth_cas' => 'libapache2-mod-auth-cas',
366-
'auth_kerb' => 'libapache2-mod-auth-kerb',
367-
'auth_openidc' => 'libapache2-mod-auth-openidc',
368-
'auth_gssapi' => 'libapache2-mod-auth-gssapi',
369-
'auth_mellon' => 'libapache2-mod-auth-mellon',
370-
'authnz_pam' => 'libapache2-mod-authnz-pam',
371-
'dav_svn' => 'libapache2-svn',
372-
'fastcgi' => 'libapache2-mod-fastcgi',
373-
'fcgid' => 'libapache2-mod-fcgid',
374-
'geoip' => 'libapache2-mod-geoip',
375-
'intercept_form_submit' => 'libapache2-mod-intercept-form-submit',
376-
'jk' => 'libapache2-mod-jk',
377-
'lookup_identity' => 'libapache2-mod-lookup-identity',
378-
'nss' => 'libapache2-mod-nss',
379-
'pagespeed' => 'mod-pagespeed-stable',
380-
'passenger' => 'libapache2-mod-passenger',
381-
'perl' => 'libapache2-mod-perl2',
382-
'phpXXX' => 'libapache2-mod-phpXXX',
383-
'proxy_html' => 'libapache2-mod-proxy-html',
384-
'python' => 'libapache2-mod-python',
385-
'rpaf' => 'libapache2-mod-rpaf',
386-
'security' => 'libapache2-modsecurity',
387-
'shib2' => 'libapache2-mod-shib2',
388-
'suphp' => 'libapache2-mod-suphp',
389-
'wsgi' => 'libapache2-mod-wsgi',
390-
'xsendfile' => 'libapache2-mod-xsendfile',
391-
}
392-
} else {
393-
$php_version = $facts['operatingsystemmajrelease'] ? {
394-
'9' => '7.0', # Debian Stretch
395-
'16.04' => '7.0', # Ubuntu Xenial
396-
'10' => '7.3', # Debian Buster
397-
'20.04' => '7.4', # Ubuntu Foccal Fossal
398-
default => '7.2', # Ubuntu Bionic, Cosmic and Disco
399-
}
400-
$mod_packages = {
401-
'apreq2' => 'libapache2-mod-apreq2',
402-
'auth_cas' => 'libapache2-mod-auth-cas',
403-
'auth_kerb' => 'libapache2-mod-auth-kerb',
404-
'auth_openidc' => 'libapache2-mod-auth-openidc',
405-
'auth_gssapi' => 'libapache2-mod-auth-gssapi',
406-
'auth_mellon' => 'libapache2-mod-auth-mellon',
407-
'authnz_pam' => 'libapache2-mod-authnz-pam',
408-
'dav_svn' => 'libapache2-mod-svn',
409-
'fastcgi' => 'libapache2-mod-fastcgi',
410-
'fcgid' => 'libapache2-mod-fcgid',
411-
'geoip' => 'libapache2-mod-geoip',
412-
'intercept_form_submit' => 'libapache2-mod-intercept-form-submit',
413-
'jk' => 'libapache2-mod-jk',
414-
'lookup_identity' => 'libapache2-mod-lookup-identity',
415-
'nss' => 'libapache2-mod-nss',
416-
'pagespeed' => 'mod-pagespeed-stable',
417-
'passenger' => 'libapache2-mod-passenger',
418-
'perl' => 'libapache2-mod-perl2',
419-
'phpXXX' => 'libapache2-mod-phpXXX',
420-
'python' => 'libapache2-mod-python',
421-
'rpaf' => 'libapache2-mod-rpaf',
422-
'security' => 'libapache2-mod-security2',
423-
'shib2' => 'libapache2-mod-shib2',
424-
'wsgi' => 'libapache2-mod-wsgi',
425-
'xsendfile' => 'libapache2-mod-xsendfile',
426-
}
361+
362+
$php_version = $facts['operatingsystemmajrelease'] ? {
363+
'9' => '7.0', # Debian Stretch
364+
'16.04' => '7.0', # Ubuntu Xenial
365+
'10' => '7.3', # Debian Buster
366+
'20.04' => '7.4', # Ubuntu Foccal Fossal
367+
default => '7.2', # Ubuntu Bionic, Cosmic and Disco
368+
}
369+
$mod_packages = {
370+
'apreq2' => 'libapache2-mod-apreq2',
371+
'auth_cas' => 'libapache2-mod-auth-cas',
372+
'auth_kerb' => 'libapache2-mod-auth-kerb',
373+
'auth_openidc' => 'libapache2-mod-auth-openidc',
374+
'auth_gssapi' => 'libapache2-mod-auth-gssapi',
375+
'auth_mellon' => 'libapache2-mod-auth-mellon',
376+
'authnz_pam' => 'libapache2-mod-authnz-pam',
377+
'dav_svn' => 'libapache2-mod-svn',
378+
'fastcgi' => 'libapache2-mod-fastcgi',
379+
'fcgid' => 'libapache2-mod-fcgid',
380+
'geoip' => 'libapache2-mod-geoip',
381+
'intercept_form_submit' => 'libapache2-mod-intercept-form-submit',
382+
'jk' => 'libapache2-mod-jk',
383+
'lookup_identity' => 'libapache2-mod-lookup-identity',
384+
'nss' => 'libapache2-mod-nss',
385+
'pagespeed' => 'mod-pagespeed-stable',
386+
'passenger' => 'libapache2-mod-passenger',
387+
'perl' => 'libapache2-mod-perl2',
388+
'phpXXX' => 'libapache2-mod-phpXXX',
389+
'python' => 'libapache2-mod-python',
390+
'rpaf' => 'libapache2-mod-rpaf',
391+
'security' => 'libapache2-mod-security2',
392+
'shib2' => 'libapache2-mod-shib2',
393+
'wsgi' => 'libapache2-mod-wsgi',
394+
'xsendfile' => 'libapache2-mod-xsendfile',
427395
}
396+
428397
$error_log = 'error.log'
429398
$scriptalias = '/usr/lib/cgi-bin'
430399
$access_log_file = 'access.log'
431-
if $::osfamily == 'Debian' and versioncmp($::operatingsystemrelease, '8') < 0 {
432-
$shib2_lib = 'mod_shib_22.so'
433-
} elsif ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '19.04') < 0) or ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '10') < 0) {
400+
if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '19.04') < 0) or ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '10') < 0) {
434401
$shib2_lib = 'mod_shib2.so'
435402
} else {
436403
$shib2_lib = 'mod_shib.so'
@@ -446,11 +413,7 @@
446413
$fastcgi_lib_path = '/var/lib/apache2/fastcgi'
447414
$mime_support_package = 'mime-support'
448415
$mime_types_config = '/etc/mime.types'
449-
if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '13.10') >= 0) or ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '8') >= 0) {
450-
$docroot = '/var/www/html'
451-
} else {
452-
$docroot = '/var/www'
453-
}
416+
$docroot = '/var/www/html'
454417
$cas_cookie_path = '/var/cache/apache2/mod_auth_cas/'
455418
$mellon_lock_file = undef
456419
$mellon_cache_size = undef
@@ -462,7 +425,7 @@
462425
$secpcrematchlimit = 1500
463426
$secpcrematchlimitrecursion = 1500
464427
$modsec_secruleengine = 'On'
465-
if ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '9') >= 0) or ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '18.04') >= 0) {
428+
if $facts['operatingsystem'] == 'Debian' or ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '18.04') >= 0) {
466429
$modsec_default_rules = [
467430
'crawlers-user-agents.data',
468431
'iis-errors.data',
@@ -510,28 +473,17 @@
510473
}
511474
$alias_icons_path = '/usr/share/apache2/icons'
512475
$error_documents_path = '/usr/share/apache2/error'
513-
if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '13.10') >= 0) or ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '8') >= 0) {
514-
$dev_packages = ['libaprutil1-dev', 'libapr1-dev', 'apache2-dev']
515-
} else {
516-
$dev_packages = ['libaprutil1-dev', 'libapr1-dev', 'apache2-prefork-dev']
517-
}
476+
$dev_packages = ['libaprutil1-dev', 'libapr1-dev', 'apache2-dev']
518477

519478
#
520479
# Passenger-specific settings
521480
#
522481

523482
$passenger_conf_file = 'passenger.conf'
524483
$passenger_conf_package_file = undef
525-
526-
if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '14.04') < 0) or ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '8') < 0) {
527-
$passenger_root = '/usr'
528-
$passenger_ruby = '/usr/bin/ruby'
529-
$passenger_default_ruby = undef
530-
} else {
531-
$passenger_root = '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini'
532-
$passenger_ruby = undef
533-
$passenger_default_ruby = '/usr/bin/ruby'
534-
}
484+
$passenger_root = '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini'
485+
$passenger_ruby = undef
486+
$passenger_default_ruby = '/usr/bin/ruby'
535487
$wsgi_socket_prefix = undef
536488
} elsif $::osfamily == 'FreeBSD' {
537489
$user = 'www'

manifests/version.pp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,7 @@
2020
}
2121
}
2222
'Debian': {
23-
if $::operatingsystem == 'Ubuntu' and versioncmp($facts['operatingsystemmajrelease'], '13.10') >= 0 {
24-
$default = '2.4'
25-
} elsif $::operatingsystem == 'Debian' and versioncmp($facts['operatingsystemmajrelease'], '8') >= 0 {
26-
$default = '2.4'
27-
} else {
28-
$default = '2.2'
29-
}
23+
$default = '2.4'
3024
}
3125
'FreeBSD': {
3226
$default = '2.4'

spec/classes/mod/php_spec.rb

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,6 @@
2020
it { is_expected.to contain_class('apache::mod::prefork') }
2121
end
2222
case facts[:os]['release']['major']
23-
when '8'
24-
context 'on jessie' do
25-
it {
26-
is_expected.to contain_file('php5.load').with(
27-
content: "LoadModule php5_module /usr/lib/apache2/modules/libphp5.so\n",
28-
)
29-
}
30-
context 'with mpm_module => itk on jessie' do
31-
let :pre_condition do
32-
'class { "apache": mpm_module => itk, }'
33-
end
34-
35-
it { is_expected.to contain_class('apache::params') }
36-
it { is_expected.to contain_class('apache::mod::itk') }
37-
it { is_expected.to contain_apache__mod('php5') }
38-
it { is_expected.to contain_package('libapache2-mod-php5') }
39-
it {
40-
is_expected.to contain_file('php5.load').with(
41-
content: "LoadModule php5_module /usr/lib/apache2/modules/libphp5.so\n",
42-
)
43-
}
44-
end
45-
end
4623
when '9'
4724
context 'on stretch' do
4825
it { is_expected.to contain_apache__mod('php7.0') }
@@ -54,7 +31,7 @@
5431
}
5532
end
5633
when '16.04'
57-
context 'on stretch' do
34+
context 'on xenial' do
5835
let :params do
5936
{ content: 'somecontent' }
6037
end
@@ -67,7 +44,7 @@
6744
end
6845

6946
when '18.04'
70-
context 'on stretch' do
47+
context 'on bionic' do
7148
let :params do
7249
{ content: 'somecontent' }
7350
end
@@ -206,11 +183,7 @@
206183
end
207184

208185
# all the following tests are for legacy php/apache versions. They don't work on modern ubuntu and redhat 8
209-
next if (facts[:os]['release']['major'].to_i > 15 && facts[:os]['name'] == 'Ubuntu') ||
210-
(facts[:os]['release']['major'].to_i >= 9 && facts[:os]['name'] == 'Debian') ||
211-
(facts[:os]['release']['major'].to_i >= 8 && (facts[:os]['name'] == 'RedHat' || facts[:os]['name'] == 'CentOS'))
212-
213-
describe 'OS independent tests' do
186+
describe 'OS independent tests', if: (facts[:os]['family'] == 'Redhat' && facts[:os]['release']['major'].to_i < 8) do
214187
context 'with content param' do
215188
let :params do
216189
{ content: 'somecontent' }

0 commit comments

Comments
 (0)