Skip to content

Commit d00aabb

Browse files
committed
Stricter data type on apache::vhost::filters
This was previously filtered out but it's best if the information simply never is entered in the first place. The include is also simplified and only applied if the vhost is present.
1 parent 2f6f6f3 commit d00aabb

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

manifests/vhost.pp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@
18551855
Optional[Variant[Array[String],String]] $redirectmatch_dest = undef,
18561856
Array[String[1]] $headers = [],
18571857
Array[String[1]] $request_headers = [],
1858-
Optional[Array[String]] $filters = undef,
1858+
Array[String[1]] $filters = [],
18591859
Optional[Array] $rewrites = undef,
18601860
Optional[String] $rewrite_base = undef,
18611861
Optional[Variant[Array[String],String]] $rewrite_rule = undef,
@@ -2259,13 +2259,6 @@
22592259
}
22602260
}
22612261

2262-
# Check if mod_filter is required to process $filters
2263-
if $filters {
2264-
if ! defined(Class['apache::mod::filter']) {
2265-
include apache::mod::filter
2266-
}
2267-
}
2268-
22692262
# Check if mod_env is required and not yet loaded.
22702263
# create an expression to simplify the conditional check
22712264
$use_env_mod = $setenv and ! empty($setenv)
@@ -2906,7 +2899,9 @@
29062899

29072900
# Template uses:
29082901
# - $filters
2909-
if $filters and ! empty($filters) {
2902+
if ! empty($filters) and $ensure == 'present' {
2903+
include apache::mod::filter
2904+
29102905
concat::fragment { "${name}-filters":
29112906
target => "${priority_real}${filename}.conf",
29122907
order => 330,

templates/vhost/_filters.erb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
<% if @filters and ! @filters.empty? -%>
1+
<% unless @filters.empty? -%>
22

33
## Filter module rules
44
## as per http://httpd.apache.org/docs/2.2/mod/mod_filter.html
5-
<%- Array(@filters).each do |filter| -%>
6-
<%- if filter != '' -%>
5+
<%- @filters.each do |filter| -%>
76
<%= filter %>
8-
<%- end -%>
97
<%- end -%>
108
<% end -%>

0 commit comments

Comments
 (0)