diff --git a/REFERENCE.md b/REFERENCE.md
index 6e678449e0..ba80e4391b 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -9985,7 +9985,7 @@ Default value: `undef`
##### `directories`
-Data type: `Optional[Array[Hash]]`
+Data type: `Array[Hash]`
The `directories` parameter within the `apache::vhost` class passes an array of hashes
to the virtual host to create [Directory](https://httpd.apache.org/docs/current/mod/core.html#directory),
@@ -10111,7 +10111,7 @@ and others.
}
```
-Default value: `undef`
+Default value: `[]`
##### `custom_fragment`
diff --git a/manifests/vhost.pp b/manifests/vhost.pp
index bb1ad02de8..8caaa9386d 100644
--- a/manifests/vhost.pp
+++ b/manifests/vhost.pp
@@ -1778,7 +1778,7 @@
Boolean $use_servername_for_filenames = false,
Boolean $use_port_for_filenames = false,
Array[Hash[String[1], String[1]]] $aliases = [],
- Optional[Array[Hash]] $directories = undef,
+ Array[Hash] $directories = [],
Boolean $error_log = true,
Optional[String] $error_log_file = undef,
Optional[String] $error_log_pipe = undef,
@@ -2152,7 +2152,7 @@
}
## Create a default directory list if none defined
- if $directories {
+ if !empty($directories) {
$_directories = $directories
} elsif $docroot {
$_directories = [
@@ -2166,7 +2166,7 @@
},
]
} else {
- $_directories = undef
+ $_directories = []
}
## Create a global LocationMatch if locations aren't defined
@@ -2309,7 +2309,7 @@
}
}
- if $_directories and ! empty($_directories) and $ensure == 'present' {
+ if $ensure == 'present' {
$_directories.each |Hash $directory| {
if 'auth_basic_authoritative' in $directory or 'auth_basic_fake' in $directory or 'auth_basic_provider' in $directory {
include apache::mod::auth_basic
@@ -2364,10 +2364,12 @@
# - $docroot
# - $shibboleth_enabled
# - $cas_enabled
- concat::fragment { "${name}-directories":
- target => "${priority_real}${filename}.conf",
- order => 60,
- content => template('apache/vhost/_directories.erb'),
+ unless empty($_directories) {
+ concat::fragment { "${name}-directories":
+ target => "${priority_real}${filename}.conf",
+ order => 60,
+ content => template('apache/vhost/_directories.erb'),
+ }
}
}