Skip to content

apache::vhost::directories: switch default from undef to empty array #2507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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