Skip to content

Commit

Permalink
Merge pull request #2507 from bastelfreak/dirs
Browse files Browse the repository at this point in the history
vhost::directories: switch default from undef to empty array
  • Loading branch information
bastelfreak authored Dec 12, 2023
2 parents b6cb8e9 + 51be584 commit 33607c2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9985,7 +9985,7 @@ Default value: `undef`

##### <a name="-apache--vhost--directories"></a>`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),
Expand Down Expand Up @@ -10111,7 +10111,7 @@ and others.
}
```
Default value: `undef`
Default value: `[]`
##### <a name="-apache--vhost--custom_fragment"></a>`custom_fragment`
Expand Down
18 changes: 10 additions & 8 deletions manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -2152,7 +2152,7 @@
}

## Create a default directory list if none defined
if $directories {
if !empty($directories) {
$_directories = $directories
} elsif $docroot {
$_directories = [
Expand All @@ -2166,7 +2166,7 @@
},
]
} else {
$_directories = undef
$_directories = []
}

## Create a global LocationMatch if locations aren't defined
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'),
}
}
}

Expand Down

0 comments on commit 33607c2

Please sign in to comment.