Skip to content

Commit 0fc5e38

Browse files
committed
Use operatingsystemmajrelease fact
This fact was introduced in Facter 1.7 which by now can be assumed. By now it's already deprecated in favor of $facts['os']['release']['major'] but the rest of the module isn't converted so this keeps it consistent.
1 parent 13b8194 commit 0fc5e38

File tree

4 files changed

+20
-27
lines changed

4 files changed

+20
-27
lines changed

manifests/init.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@
551551
default => '(event|itk|prefork|worker)'
552552
}
553553

554-
if $::osfamily == 'RedHat' and $apache::version::distrelease == '7' {
554+
if $::osfamily == 'RedHat' and $facts['operatingsystemmajrelease'] == '7' {
555555
# On redhat 7 the ssl.conf lives in /etc/httpd/conf.d (the confd_dir)
556556
# when all other module configs live in /etc/httpd/conf.modules.d (the
557557
# mod_dir). On all other platforms and versions, ssl.conf lives in the

manifests/mod/proxy_html.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
}
2222
case $::operatingsystem {
2323
'Ubuntu': {
24-
$loadfiles = $apache::params::distrelease ? {
24+
$loadfiles = $facts['operatingsystemmajrelease'] ? {
2525
'10' => ['/usr/lib/libxml2.so.2'],
2626
default => ["/usr/lib/${gnu_path}-linux-gnu/libxml2.so.2"],
2727
}
2828
}
2929
'Debian': {
30-
$loadfiles = $apache::params::distrelease ? {
30+
$loadfiles = $facts['operatingsystemmajrelease'] ? {
3131
'6' => ['/usr/lib/libxml2.so.2'],
3232
default => ["/usr/lib/${gnu_path}-linux-gnu/libxml2.so.2"],
3333
}

manifests/params.pp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
$server_root = "${httpd_root}/etc/httpd"
6262
$conf_dir = "${httpd_dir}/conf"
6363
$confd_dir = "${httpd_dir}/conf.d"
64-
$mod_dir = $apache::version::distrelease ? {
64+
$mod_dir = $facts['operatingsystemmajrelease'] ? {
6565
'7' => "${httpd_dir}/conf.modules.d",
6666
default => "${httpd_dir}/conf.d",
6767
}
@@ -107,11 +107,11 @@
107107
$mime_support_package = 'mailcap'
108108
$mime_types_config = '/etc/mime.types'
109109
$docroot = "${httpd_root}/var/www/html"
110-
$alias_icons_path = $apache::version::distrelease ? {
110+
$alias_icons_path = $facts['operatingsystemmajrelease'] ? {
111111
'7' => "${httpd_root}/usr/share/httpd/icons",
112112
default => '/var/www/icons',
113113
}
114-
$error_documents_path = $apache::version::distrelease ? {
114+
$error_documents_path = $facts['operatingsystemmajrelease'] ? {
115115
'7' => "${httpd_root}/usr/share/httpd/error",
116116
default => '/var/www/error'
117117
}
@@ -172,7 +172,7 @@
172172
# Amazon Linux 2 uses the /conf.modules.d/ dir
173173
$mod_dir = "${httpd_dir}/conf.modules.d"
174174
} else {
175-
$mod_dir = $apache::version::distrelease ? {
175+
$mod_dir = $facts['operatingsystemmajrelease'] ? {
176176
'7' => "${httpd_dir}/conf.modules.d",
177177
'8' => "${httpd_dir}/conf.modules.d",
178178
default => "${httpd_dir}/conf.d",
@@ -200,7 +200,7 @@
200200
$suphp_addhandler = 'php5-script'
201201
$suphp_engine = 'off'
202202
$suphp_configpath = undef
203-
$php_version = $apache::version::distrelease ? {
203+
$php_version = $facts['operatingsystemmajrelease'] ? {
204204
'8' => '7', # RedHat8
205205
default => '5', # RedHat5, RedHat6, RedHat7
206206
}
@@ -211,21 +211,21 @@
211211
'auth_gssapi' => 'mod_auth_gssapi',
212212
'auth_mellon' => 'mod_auth_mellon',
213213
'auth_openidc' => 'mod_auth_openidc',
214-
'authnz_ldap' => $apache::version::distrelease ? {
214+
'authnz_ldap' => $facts['operatingsystemmajrelease'] ? {
215215
'7' => 'mod_ldap',
216216
'8' => 'mod_ldap',
217217
default => 'mod_authz_ldap',
218218
},
219219
'authnz_pam' => 'mod_authnz_pam',
220-
'fastcgi' => $apache::version::distrelease ? {
220+
'fastcgi' => $facts['operatingsystemmajrelease'] ? {
221221
'5' => 'mod_fastcgi',
222222
'6' => 'mod_fastcgi',
223223
default => undef,
224224
},
225225
'fcgid' => 'mod_fcgid',
226226
'geoip' => 'mod_geoip',
227227
'intercept_form_submit' => 'mod_intercept_form_submit',
228-
'ldap' => $apache::version::distrelease ? {
228+
'ldap' => $facts['operatingsystemmajrelease'] ? {
229229
'5' => undef,
230230
'6' => undef,
231231
default => 'mod_ldap',
@@ -239,7 +239,7 @@
239239
# https://www.phusionpassenger.com/library/install/apache/install/oss/el7/
240240
'passenger' => 'mod_passenger',
241241
'perl' => 'mod_perl',
242-
'php5' => $apache::version::distrelease ? {
242+
'php5' => $facts['operatingsystemmajrelease'] ? {
243243
'5' => 'php53',
244244
default => 'php',
245245
},
@@ -252,7 +252,7 @@
252252
# See http://wiki.aaf.edu.au/tech-info/sp-install-guide
253253
'shibboleth' => 'shibboleth',
254254
'ssl' => 'mod_ssl',
255-
'wsgi' => $apache::version::distrelease ? {
255+
'wsgi' => $facts['operatingsystemmajrelease'] ? {
256256
'8' => 'python3-mod_wsgi', # RedHat8
257257
default => 'mod_wsgi', # RedHat5, RedHat6, RedHat7
258258
},
@@ -264,7 +264,7 @@
264264
}
265265
$mod_libs = {
266266
'nss' => 'libmodnss.so',
267-
'wsgi' => $apache::version::distrelease ? {
267+
'wsgi' => $facts['operatingsystemmajrelease'] ? {
268268
'8' => 'mod_wsgi_python3.so',
269269
default => 'mod_wsgi.so',
270270
},
@@ -278,12 +278,12 @@
278278
$mime_support_package = 'mailcap'
279279
$mime_types_config = '/etc/mime.types'
280280
$docroot = '/var/www/html'
281-
$alias_icons_path = $apache::version::distrelease ? {
281+
$alias_icons_path = $facts['operatingsystemmajrelease'] ? {
282282
'7' => '/usr/share/httpd/icons',
283283
'8' => '/usr/share/httpd/icons',
284284
default => '/var/www/icons',
285285
}
286-
$error_documents_path = $apache::version::distrelease ? {
286+
$error_documents_path = $facts['operatingsystemmajrelease'] ? {
287287
'7' => '/usr/share/httpd/error',
288288
'8' => '/usr/share/httpd/error',
289289
default => '/var/www/error'

manifests/version.pp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,23 @@
66
Optional[String] $scl_httpd_version = undef,
77
Optional[String] $scl_php_version = undef,
88
) {
9-
# This will be 5 or 6 on RedHat, 6 or wheezy on Debian, 12 or quantal on Ubuntu, etc.
10-
$osr_array = split($::operatingsystemrelease,'[\/\.]')
11-
$distrelease = $osr_array[0]
12-
if ! $distrelease {
13-
fail("Class['apache::version']: Unparsable \$::operatingsystemrelease: ${::operatingsystemrelease}")
14-
}
15-
169
case $::osfamily {
1710
'RedHat': {
1811
if $scl_httpd_version {
1912
$default = $scl_httpd_version
2013
}
2114
elsif ($::operatingsystem == 'Amazon') {
2215
$default = '2.2'
23-
} elsif ($::operatingsystem == 'Fedora' and versioncmp($distrelease, '18') >= 0) or ($::operatingsystem != 'Fedora' and versioncmp($distrelease, '7') >= 0) {
16+
} elsif ($::operatingsystem == 'Fedora' and versioncmp($facts['operatingsystemmajrelease'], '18') >= 0) or ($::operatingsystem != 'Fedora' and versioncmp($facts['operatingsystemmajrelease'], '7') >= 0) {
2417
$default = '2.4'
2518
} else {
2619
$default = '2.2'
2720
}
2821
}
2922
'Debian': {
30-
if $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '13.10') >= 0 {
23+
if $::operatingsystem == 'Ubuntu' and versioncmp($facts['operatingsystemmajrelease'], '13.10') >= 0 {
3124
$default = '2.4'
32-
} elsif $::operatingsystem == 'Debian' and versioncmp($distrelease, '8') >= 0 {
25+
} elsif $::operatingsystem == 'Debian' and versioncmp($facts['operatingsystemmajrelease'], '8') >= 0 {
3326
$default = '2.4'
3427
} else {
3528
$default = '2.2'
@@ -42,7 +35,7 @@
4235
$default = '2.4'
4336
}
4437
'Suse': {
45-
if ($::operatingsystem == 'SLES' and versioncmp($::operatingsystemrelease, '12') >= 0) or ($::operatingsystem == 'OpenSuSE' and versioncmp($::operatingsystemrelease, '42') >= 0) {
38+
if ($::operatingsystem == 'SLES' and versioncmp($facts['operatingsystemmajrelease'], '12') >= 0) or ($::operatingsystem == 'OpenSuSE' and versioncmp($facts['operatingsystemmajrelease'], '42') >= 0) {
4639
$default = '2.4'
4740
} else {
4841
$default = '2.2'

0 commit comments

Comments
 (0)