Skip to content

Compare with major release version #2110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifests/default_mods.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
if versioncmp($apache_version, '2.4') >= 0 {
# Lets fork it
# Do not try to load mod_systemd on RHEL/CentOS 6 SCL.
if ( !($::osfamily == 'redhat' and versioncmp($::operatingsystemrelease, '7.0') == -1) and !($::operatingsystem == 'Amazon') ) {
if ( !($::osfamily == 'redhat' and versioncmp($::operatingsystemmajrelease, '7') == -1) and !($::operatingsystem == 'Amazon') ) {
if ($use_systemd) {
::apache::mod { 'systemd': }
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@
default => '(event|itk|prefork|worker)'
}

if $::osfamily == 'RedHat' and $apache::version::distrelease == '7' {
if $::osfamily == 'RedHat' and $facts['operatingsystemmajrelease'] == '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
# mod_dir). On all other platforms and versions, ssl.conf lives in the
Expand Down
2 changes: 1 addition & 1 deletion manifests/mod/fastcgi.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
class apache::mod::fastcgi {
include apache
if ($::osfamily == 'Redhat' and versioncmp($::operatingsystemrelease, '7.0') >= 0) {
if ($::osfamily == 'Redhat' and versioncmp($::operatingsystemmajrelease, '7') >= 0) {
fail('mod_fastcgi is no longer supported on el7 and above.')
}
if ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '18.04') >= 0) {
Expand Down
4 changes: 2 additions & 2 deletions manifests/mod/proxy_html.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
}
case $::operatingsystem {
'Ubuntu': {
$loadfiles = $apache::params::distrelease ? {
$loadfiles = $facts['operatingsystemmajrelease'] ? {
'10' => ['/usr/lib/libxml2.so.2'],
default => ["/usr/lib/${gnu_path}-linux-gnu/libxml2.so.2"],
}
}
'Debian': {
$loadfiles = $apache::params::distrelease ? {
$loadfiles = $facts['operatingsystemmajrelease'] ? {
'6' => ['/usr/lib/libxml2.so.2'],
default => ["/usr/lib/${gnu_path}-linux-gnu/libxml2.so.2"],
}
Expand Down
28 changes: 14 additions & 14 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
$server_root = "${httpd_root}/etc/httpd"
$conf_dir = "${httpd_dir}/conf"
$confd_dir = "${httpd_dir}/conf.d"
$mod_dir = $apache::version::distrelease ? {
$mod_dir = $facts['operatingsystemmajrelease'] ? {
'7' => "${httpd_dir}/conf.modules.d",
default => "${httpd_dir}/conf.d",
}
Expand Down Expand Up @@ -107,11 +107,11 @@
$mime_support_package = 'mailcap'
$mime_types_config = '/etc/mime.types'
$docroot = "${httpd_root}/var/www/html"
$alias_icons_path = $apache::version::distrelease ? {
$alias_icons_path = $facts['operatingsystemmajrelease'] ? {
'7' => "${httpd_root}/usr/share/httpd/icons",
default => '/var/www/icons',
}
$error_documents_path = $apache::version::distrelease ? {
$error_documents_path = $facts['operatingsystemmajrelease'] ? {
'7' => "${httpd_root}/usr/share/httpd/error",
default => '/var/www/error'
}
Expand Down Expand Up @@ -172,7 +172,7 @@
# Amazon Linux 2 uses the /conf.modules.d/ dir
$mod_dir = "${httpd_dir}/conf.modules.d"
} else {
$mod_dir = $apache::version::distrelease ? {
$mod_dir = $facts['operatingsystemmajrelease'] ? {
'7' => "${httpd_dir}/conf.modules.d",
'8' => "${httpd_dir}/conf.modules.d",
default => "${httpd_dir}/conf.d",
Expand Down Expand Up @@ -200,7 +200,7 @@
$suphp_addhandler = 'php5-script'
$suphp_engine = 'off'
$suphp_configpath = undef
$php_version = $apache::version::distrelease ? {
$php_version = $facts['operatingsystemmajrelease'] ? {
'8' => '7', # RedHat8
default => '5', # RedHat5, RedHat6, RedHat7
}
Expand All @@ -211,21 +211,21 @@
'auth_gssapi' => 'mod_auth_gssapi',
'auth_mellon' => 'mod_auth_mellon',
'auth_openidc' => 'mod_auth_openidc',
'authnz_ldap' => $apache::version::distrelease ? {
'authnz_ldap' => $facts['operatingsystemmajrelease'] ? {
'7' => 'mod_ldap',
'8' => 'mod_ldap',
default => 'mod_authz_ldap',
},
'authnz_pam' => 'mod_authnz_pam',
'fastcgi' => $apache::version::distrelease ? {
'fastcgi' => $facts['operatingsystemmajrelease'] ? {
'5' => 'mod_fastcgi',
'6' => 'mod_fastcgi',
default => undef,
},
'fcgid' => 'mod_fcgid',
'geoip' => 'mod_geoip',
'intercept_form_submit' => 'mod_intercept_form_submit',
'ldap' => $apache::version::distrelease ? {
'ldap' => $facts['operatingsystemmajrelease'] ? {
'5' => undef,
'6' => undef,
default => 'mod_ldap',
Expand All @@ -239,7 +239,7 @@
# https://www.phusionpassenger.com/library/install/apache/install/oss/el7/
'passenger' => 'mod_passenger',
'perl' => 'mod_perl',
'php5' => $apache::version::distrelease ? {
'php5' => $facts['operatingsystemmajrelease'] ? {
'5' => 'php53',
default => 'php',
},
Expand All @@ -252,7 +252,7 @@
# See http://wiki.aaf.edu.au/tech-info/sp-install-guide
'shibboleth' => 'shibboleth',
'ssl' => 'mod_ssl',
'wsgi' => $apache::version::distrelease ? {
'wsgi' => $facts['operatingsystemmajrelease'] ? {
'8' => 'python3-mod_wsgi', # RedHat8
default => 'mod_wsgi', # RedHat5, RedHat6, RedHat7
},
Expand All @@ -264,7 +264,7 @@
}
$mod_libs = {
'nss' => 'libmodnss.so',
'wsgi' => $apache::version::distrelease ? {
'wsgi' => $facts['operatingsystemmajrelease'] ? {
'8' => 'mod_wsgi_python3.so',
default => 'mod_wsgi.so',
},
Expand All @@ -278,12 +278,12 @@
$mime_support_package = 'mailcap'
$mime_types_config = '/etc/mime.types'
$docroot = '/var/www/html'
$alias_icons_path = $apache::version::distrelease ? {
$alias_icons_path = $facts['operatingsystemmajrelease'] ? {
'7' => '/usr/share/httpd/icons',
'8' => '/usr/share/httpd/icons',
default => '/var/www/icons',
}
$error_documents_path = $apache::version::distrelease ? {
$error_documents_path = $facts['operatingsystemmajrelease'] ? {
'7' => '/usr/share/httpd/error',
'8' => '/usr/share/httpd/error',
default => '/var/www/error'
Expand Down Expand Up @@ -790,7 +790,7 @@
$verify_command = '/usr/sbin/apachectl -t'
}

if $::osfamily == 'RedHat' and versioncmp($::operatingsystemrelease, '8.0') >= 0 {
if $::osfamily == 'RedHat' and versioncmp($facts['operatingsystemmajrelease'], '8') >= 0 {
$ssl_protocol = ['all'] # Implementations of the SSLv2 and SSLv3 protocol versions have been removed from OpenSSL (and hence mod_ssl) because these are no longer considered secure. For additional documentation https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/deploying_different_types_of_servers/setting-apache-web-server_deploying-different-types-of-servers
} else {
$ssl_protocol = ['all', '-SSLv2', '-SSLv3']
Expand Down
15 changes: 4 additions & 11 deletions manifests/version.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,23 @@
Optional[String] $scl_httpd_version = undef,
Optional[String] $scl_php_version = undef,
) {
# This will be 5 or 6 on RedHat, 6 or wheezy on Debian, 12 or quantal on Ubuntu, etc.
$osr_array = split($::operatingsystemrelease,'[\/\.]')
$distrelease = $osr_array[0]
if ! $distrelease {
fail("Class['apache::version']: Unparsable \$::operatingsystemrelease: ${::operatingsystemrelease}")
}

case $::osfamily {
'RedHat': {
if $scl_httpd_version {
$default = $scl_httpd_version
}
elsif ($::operatingsystem == 'Amazon') {
$default = '2.2'
} elsif ($::operatingsystem == 'Fedora' and versioncmp($distrelease, '18') >= 0) or ($::operatingsystem != 'Fedora' and versioncmp($distrelease, '7') >= 0) {
} elsif ($::operatingsystem == 'Fedora' and versioncmp($facts['operatingsystemmajrelease'], '18') >= 0) or ($::operatingsystem != 'Fedora' and versioncmp($facts['operatingsystemmajrelease'], '7') >= 0) {
$default = '2.4'
} else {
$default = '2.2'
}
}
'Debian': {
if $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '13.10') >= 0 {
if $::operatingsystem == 'Ubuntu' and versioncmp($facts['operatingsystemmajrelease'], '13.10') >= 0 {
$default = '2.4'
} elsif $::operatingsystem == 'Debian' and versioncmp($distrelease, '8') >= 0 {
} elsif $::operatingsystem == 'Debian' and versioncmp($facts['operatingsystemmajrelease'], '8') >= 0 {
$default = '2.4'
} else {
$default = '2.2'
Expand All @@ -42,7 +35,7 @@
$default = '2.4'
}
'Suse': {
if ($::operatingsystem == 'SLES' and versioncmp($::operatingsystemrelease, '12') >= 0) or ($::operatingsystem == 'OpenSuSE' and versioncmp($::operatingsystemrelease, '42') >= 0) {
if ($::operatingsystem == 'SLES' and versioncmp($facts['operatingsystemmajrelease'], '12') >= 0) or ($::operatingsystem == 'OpenSuSE' and versioncmp($facts['operatingsystemmajrelease'], '42') >= 0) {
$default = '2.4'
} else {
$default = '2.2'
Expand Down
7 changes: 6 additions & 1 deletion spec/spec_helper_local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
osfamily: 'RedHat',
operatingsystem: 'Fedora',
operatingsystemrelease: '17',
operatingsystemmajrelease: '17',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
Expand All @@ -78,6 +79,7 @@
osfamily: 'RedHat',
operatingsystem: 'Fedora',
operatingsystemrelease: '21',
operatingsystemmajrelease: '21',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
Expand All @@ -91,6 +93,7 @@
osfamily: 'RedHat',
operatingsystem: 'Fedora',
operatingsystemrelease: '28',
operatingsystemmajrelease: '28',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
Expand All @@ -104,6 +107,7 @@
osfamily: 'RedHat',
operatingsystem: 'Fedora',
operatingsystemrelease: 'Rawhide',
operatingsystemmajrelease: 'Rawhide',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
Expand Down Expand Up @@ -142,7 +146,8 @@
kernel: 'Linux',
osfamily: 'Gentoo',
operatingsystem: 'Gentoo',
operatingsystemrelease: '3.16.1-gentoo',
operatingsystemrelease: '2.7',
operatingsystemmajrelease: '2.7',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin',
}
end
Expand Down