Skip to content

Commit 33607c2

Browse files
authored
Merge pull request #2507 from bastelfreak/dirs
vhost::directories: switch default from undef to empty array
2 parents b6cb8e9 + 51be584 commit 33607c2

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

REFERENCE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9985,7 +9985,7 @@ Default value: `undef`
99859985

99869986
##### <a name="-apache--vhost--directories"></a>`directories`
99879987

9988-
Data type: `Optional[Array[Hash]]`
9988+
Data type: `Array[Hash]`
99899989

99909990
The `directories` parameter within the `apache::vhost` class passes an array of hashes
99919991
to the virtual host to create [Directory](https://httpd.apache.org/docs/current/mod/core.html#directory),
@@ -10111,7 +10111,7 @@ and others.
1011110111
}
1011210112
```
1011310113
10114-
Default value: `undef`
10114+
Default value: `[]`
1011510115
1011610116
##### <a name="-apache--vhost--custom_fragment"></a>`custom_fragment`
1011710117

manifests/vhost.pp

+10-8
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@
17781778
Boolean $use_servername_for_filenames = false,
17791779
Boolean $use_port_for_filenames = false,
17801780
Array[Hash[String[1], String[1]]] $aliases = [],
1781-
Optional[Array[Hash]] $directories = undef,
1781+
Array[Hash] $directories = [],
17821782
Boolean $error_log = true,
17831783
Optional[String] $error_log_file = undef,
17841784
Optional[String] $error_log_pipe = undef,
@@ -2152,7 +2152,7 @@
21522152
}
21532153

21542154
## Create a default directory list if none defined
2155-
if $directories {
2155+
if !empty($directories) {
21562156
$_directories = $directories
21572157
} elsif $docroot {
21582158
$_directories = [
@@ -2166,7 +2166,7 @@
21662166
},
21672167
]
21682168
} else {
2169-
$_directories = undef
2169+
$_directories = []
21702170
}
21712171

21722172
## Create a global LocationMatch if locations aren't defined
@@ -2309,7 +2309,7 @@
23092309
}
23102310
}
23112311

2312-
if $_directories and ! empty($_directories) and $ensure == 'present' {
2312+
if $ensure == 'present' {
23132313
$_directories.each |Hash $directory| {
23142314
if 'auth_basic_authoritative' in $directory or 'auth_basic_fake' in $directory or 'auth_basic_provider' in $directory {
23152315
include apache::mod::auth_basic
@@ -2364,10 +2364,12 @@
23642364
# - $docroot
23652365
# - $shibboleth_enabled
23662366
# - $cas_enabled
2367-
concat::fragment { "${name}-directories":
2368-
target => "${priority_real}${filename}.conf",
2369-
order => 60,
2370-
content => template('apache/vhost/_directories.erb'),
2367+
unless empty($_directories) {
2368+
concat::fragment { "${name}-directories":
2369+
target => "${priority_real}${filename}.conf",
2370+
order => 60,
2371+
content => template('apache/vhost/_directories.erb'),
2372+
}
23712373
}
23722374
}
23732375

0 commit comments

Comments
 (0)