Skip to content

Commit a844191

Browse files
intelradouxbmjen
authored andcommitted
[MODULES-1491] mod_dir is empty when instanciating apache::mod::... (puppetlabs#1541)
Add "include ::apache" on class that needed that. Apache version also need to be "pick" so that version resolution is correct.
1 parent 353fa4f commit a844191

16 files changed

+52
-27
lines changed

manifests/mod/autoindex.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class apache::mod::autoindex {
2+
include ::apache
23
::apache::mod { 'autoindex': }
34
# Template uses no variables
45
file { 'autoindex.conf':

manifests/mod/cgid.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class apache::mod::cgid {
2+
include ::apache
23
case $::osfamily {
34
'FreeBSD': {}
45
default: {

manifests/mod/dav_fs.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class apache::mod::dav_fs {
2+
include ::apache
23
$dav_lock = $::osfamily ? {
34
'debian' => "\${APACHE_LOCK_DIR}/DAVLock",
45
'freebsd' => '/usr/local/var/DavLock',

manifests/mod/disk_cache.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
class apache::mod::disk_cache (
22
$cache_root = undef,
33
) {
4+
include ::apache
45
if $cache_root {
56
$_cache_root = $cache_root
67
}

manifests/mod/dumpio.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
$dump_io_input = 'Off',
33
$dump_io_output = 'Off',
44
) {
5-
5+
include ::apache
66
validate_re(downcase($dump_io_input), '^(on|off)$', "${dump_io_input} is not supported for dump_io_input. Allowed values are 'On' and 'Off'.")
77
validate_re(downcase($dump_io_output), '^(on|off)$', "${dump_io_output} is not supported for dump_io_output. Allowed values are 'On' and 'Off'.")
88

manifests/mod/event.pp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
$maxrequestsperchild = '0',
99
$maxconnectionsperchild = undef,
1010
$serverlimit = '25',
11-
$apache_version = $::apache::apache_version,
11+
$apache_version = undef,
1212
$threadlimit = '64',
1313
$listenbacklog = '511',
1414
) {
15+
include ::apache
16+
17+
$_apache_version = pick($apache_version, $apache::apache_version)
18+
1519
if defined(Class['apache::mod::itk']) {
1620
fail('May not include both apache::mod::event and apache::mod::itk on the same node')
1721
}
@@ -49,15 +53,15 @@
4953

5054
case $::osfamily {
5155
'redhat': {
52-
if versioncmp($apache_version, '2.4') >= 0 {
56+
if versioncmp($_apache_version, '2.4') >= 0 {
5357
apache::mpm{ 'event':
54-
apache_version => $apache_version,
58+
apache_version => $_apache_version,
5559
}
5660
}
5761
}
5862
'debian','freebsd' : {
5963
apache::mpm{ 'event':
60-
apache_version => $apache_version,
64+
apache_version => $_apache_version,
6165
}
6266
}
6367
'gentoo': {

manifests/mod/geoip.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
$scan_proxy_header_field = undef,
99
$use_last_xforwarededfor_ip = undef,
1010
) {
11+
include ::apache
1112
::apache::mod { 'geoip': }
1213

1314
# Template uses:

manifests/mod/itk.pp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@
55
$serverlimit = '256',
66
$maxclients = '256',
77
$maxrequestsperchild = '4000',
8-
$apache_version = $::apache::apache_version,
8+
$apache_version = undef,
99
) {
10+
include ::apache
11+
12+
$_apache_version = pick($apache_version, $apache::apache_version)
13+
1014
if defined(Class['apache::mod::event']) {
1115
fail('May not include both apache::mod::itk and apache::mod::event on the same node')
1216
}
1317
if defined(Class['apache::mod::peruser']) {
1418
fail('May not include both apache::mod::itk and apache::mod::peruser on the same node')
1519
}
16-
if versioncmp($apache_version, '2.4') < 0 {
20+
if versioncmp($_apache_version, '2.4') < 0 {
1721
if defined(Class['apache::mod::prefork']) {
1822
fail('May not include both apache::mod::itk and apache::mod::prefork on the same node')
1923
}
@@ -59,9 +63,9 @@
5963
package { 'httpd-itk':
6064
ensure => present,
6165
}
62-
if versioncmp($apache_version, '2.4') >= 0 {
66+
if versioncmp($_apache_version, '2.4') >= 0 {
6367
::apache::mpm{ 'itk':
64-
apache_version => $apache_version,
68+
apache_version => $_apache_version,
6569
}
6670
}
6771
else {
@@ -77,7 +81,7 @@
7781
}
7882
'debian', 'freebsd': {
7983
apache::mpm{ 'itk':
80-
apache_version => $apache_version,
84+
apache_version => $_apache_version,
8185
}
8286
}
8387
'gentoo': {

manifests/mod/nss.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
$passwd_file = undef,
55
$port = 8443,
66
) {
7+
include ::apache
78
include ::apache::mod::mime
89

910
apache::mod { 'nss': }

manifests/mod/peruser.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
$expiretimeout = '120',
99
$keepalive = 'Off',
1010
) {
11-
11+
include ::apache
1212
case $::osfamily {
1313
'freebsd' : {
1414
fail("Unsupported osfamily ${::osfamily}")

manifests/mod/php.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
$root_group = $::apache::params::root_group,
1010
$php_version = $::apache::params::php_version,
1111
) inherits apache::params {
12-
12+
include ::apache
1313
$mod = "php${php_version}"
1414

1515
if defined(Class['::apache::mod::prefork']) {

manifests/mod/prefork.pp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
$serverlimit = '256',
66
$maxclients = '256',
77
$maxrequestsperchild = '4000',
8-
$apache_version = $::apache::apache_version,
8+
$apache_version = undef,
99
) {
10+
include ::apache
11+
$_apache_version = pick($apache_version, $apache::apache_version)
1012
if defined(Class['apache::mod::event']) {
1113
fail('May not include both apache::mod::prefork and apache::mod::event on the same node')
1214
}
13-
if versioncmp($apache_version, '2.4') < 0 {
15+
if versioncmp($_apache_version, '2.4') < 0 {
1416
if defined(Class['apache::mod::itk']) {
1517
fail('May not include both apache::mod::prefork and apache::mod::itk on the same node')
1618
}
@@ -44,9 +46,9 @@
4446

4547
case $::osfamily {
4648
'redhat': {
47-
if versioncmp($apache_version, '2.4') >= 0 {
49+
if versioncmp($_apache_version, '2.4') >= 0 {
4850
::apache::mpm{ 'prefork':
49-
apache_version => $apache_version,
51+
apache_version => $_apache_version,
5052
}
5153
}
5254
else {
@@ -62,7 +64,7 @@
6264
}
6365
'debian', 'freebsd': {
6466
::apache::mpm{ 'prefork':
65-
apache_version => $apache_version,
67+
apache_version => $_apache_version,
6668
}
6769
}
6870
'Suse': {

manifests/mod/setenvif.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class apache::mod::setenvif {
2+
include ::apache
23
::apache::mod { 'setenvif': }
34
# Template uses no variables
45
file { 'setenvif.conf':

manifests/mod/userdir.pp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
$home = '/home',
33
$dir = 'public_html',
44
$disable_root = true,
5-
$apache_version = $::apache::apache_version,
5+
$apache_version = undef,
66
$options = [ 'MultiViews', 'Indexes', 'SymLinksIfOwnerMatch', 'IncludesNoExec' ],
77
) {
8+
include ::apache
9+
$_apache_version = pick($apache_version, $apache::apache_version)
10+
811
::apache::mod { 'userdir': }
912

10-
# Template uses $home, $dir, $disable_root, $apache_version
13+
# Template uses $home, $dir, $disable_root, $_apache_version
1114
file { 'userdir.conf':
1215
ensure => file,
1316
path => "${::apache::mod_dir}/userdir.conf",

manifests/mod/worker.pp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,11 @@
6262
$serverlimit = '25',
6363
$threadlimit = '64',
6464
$listenbacklog = '511',
65-
$apache_version = $::apache::apache_version,
65+
$apache_version = undef,
6666
) {
67+
include ::apache
68+
$_apache_version = pick($apache_version, $apache::apache_version)
69+
6770
if defined(Class['apache::mod::event']) {
6871
fail('May not include both apache::mod::worker and apache::mod::event on the same node')
6972
}
@@ -102,9 +105,10 @@
102105

103106
case $::osfamily {
104107
'redhat': {
105-
if versioncmp($apache_version, '2.4') >= 0 {
106-
::apache::mpm { 'worker':
107-
apache_version => $apache_version,
108+
109+
if versioncmp($_apache_version, '2.4') >= 0 {
110+
::apache::mpm{ 'worker':
111+
apache_version => $_apache_version,
108112
}
109113
}
110114
else {
@@ -118,9 +122,10 @@
118122
}
119123
}
120124
}
125+
121126
'debian', 'freebsd': {
122-
::apache::mpm { 'worker':
123-
apache_version => $apache_version,
127+
::apache::mpm{ 'worker':
128+
apache_version => $_apache_version,
124129
}
125130
}
126131
'Suse': {

templates/mod/userdir.conf.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
AllowOverride FileInfo AuthConfig Limit Indexes
99
Options <%= @options.join(' ') %>
1010
<Limit GET POST OPTIONS>
11-
<%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%>
11+
<%- if scope.function_versioncmp([@_apache_version, '2.4']) >= 0 -%>
1212
Require all granted
1313
<%- else -%>
1414
Order allow,deny
1515
Allow from all
1616
<%- end -%>
1717
</Limit>
1818
<LimitExcept GET POST OPTIONS>
19-
<%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%>
19+
<%- if scope.function_versioncmp([@_apache_version, '2.4']) >= 0 -%>
2020
Require all granted
2121
<%- else -%>
2222
Order allow,deny

0 commit comments

Comments
 (0)