|
1800 | 1800 | Variant[Boolean,String] $access_log_syslog = false,
|
1801 | 1801 | Variant[Boolean,String] $access_log_format = false,
|
1802 | 1802 | Variant[Boolean,String] $access_log_env_var = false,
|
1803 |
| - Optional[Array] $access_logs = undef, |
| 1803 | + Optional[Array[Hash]] $access_logs = undef, |
1804 | 1804 | Boolean $use_servername_for_filenames = false,
|
1805 | 1805 | Boolean $use_port_for_filenames = false,
|
1806 | 1806 | Optional[Variant[Array[Hash],Hash,String]] $aliases = undef,
|
|
1853 | 1853 | Optional[Variant[Array[String],String]] $redirectmatch_status = undef,
|
1854 | 1854 | Optional[Variant[Array[String],String]] $redirectmatch_regexp = undef,
|
1855 | 1855 | Optional[Variant[Array[String],String]] $redirectmatch_dest = undef,
|
1856 |
| - Optional[String] $headers = undef, |
1857 |
| - Optional[Array[String]] $request_headers = undef, |
1858 |
| - Optional[Array[String]] $filters = undef, |
1859 |
| - Optional[Array] $rewrites = undef, |
1860 |
| - Optional[String] $rewrite_base = undef, |
1861 |
| - Optional[Variant[Array[String],String]] $rewrite_rule = undef, |
1862 |
| - Optional[Variant[Array[String],String]] $rewrite_cond = undef, |
| 1856 | + Array[String[1]] $headers = [], |
| 1857 | + Array[String[1]] $request_headers = [], |
| 1858 | + Array[String[1]] $filters = [], |
| 1859 | + Array[Hash] $rewrites = [], |
| 1860 | + Optional[String[1]] $rewrite_base = undef, |
| 1861 | + Optional[String[1]] $rewrite_rule = undef, |
| 1862 | + Array[String[1]] $rewrite_cond = [], |
1863 | 1863 | Boolean $rewrite_inherit = false,
|
1864 | 1864 | Variant[Array[String],String] $setenv = [],
|
1865 | 1865 | Variant[Array[String],String] $setenvif = [],
|
|
1954 | 1954 | Optional[String] $add_default_charset = undef,
|
1955 | 1955 | Boolean $modsec_disable_vhost = false,
|
1956 | 1956 | Optional[Variant[Hash, Array]] $modsec_disable_ids = undef,
|
1957 |
| - Optional[Array[String]] $modsec_disable_ips = undef, |
| 1957 | + Array[String[1]] $modsec_disable_ips = [], |
1958 | 1958 | Optional[Variant[Hash, Array]] $modsec_disable_msgs = undef,
|
1959 | 1959 | Optional[Variant[Hash, Array]] $modsec_disable_tags = undef,
|
1960 | 1960 | Optional[String] $modsec_body_limit = undef,
|
1961 |
| - Optional[Array[Hash]] $jk_mounts = undef, |
| 1961 | + Array[Hash] $jk_mounts = [], |
1962 | 1962 | Boolean $auth_kerb = false,
|
1963 | 1963 | Enum['on', 'off'] $krb_method_negotiate = 'on',
|
1964 | 1964 | Enum['on', 'off'] $krb_method_k5passwd = 'on',
|
|
1997 | 1997 |
|
1998 | 1998 | $apache_name = $apache::apache_name
|
1999 | 1999 |
|
2000 |
| - if $rewrites { |
2001 |
| - unless empty($rewrites) { |
2002 |
| - $rewrites_flattened = delete_undef_values(flatten([$rewrites])) |
2003 |
| - assert_type(Array[Hash], $rewrites_flattened) |
2004 |
| - } |
2005 |
| - } |
2006 |
| - |
2007 | 2000 | # Input validation begins
|
2008 | 2001 |
|
2009 | 2002 | if $access_log_file and $access_log_pipe {
|
|
2141 | 2134 | }]
|
2142 | 2135 | } elsif $access_logs {
|
2143 | 2136 | $_access_logs = $access_logs
|
| 2137 | + } else { |
| 2138 | + $_access_logs = [] |
2144 | 2139 | }
|
2145 | 2140 |
|
2146 | 2141 | if $error_log_file {
|
|
2225 | 2220 | }
|
2226 | 2221 | }
|
2227 | 2222 |
|
2228 |
| - # Load mod_rewrite if needed and not yet loaded |
2229 |
| - if $rewrites or $rewrite_cond { |
2230 |
| - if ! defined(Class['apache::mod::rewrite']) { |
2231 |
| - include apache::mod::rewrite |
2232 |
| - } |
2233 |
| - } |
2234 |
| - |
2235 | 2223 | # Load mod_alias if needed and not yet loaded
|
2236 | 2224 | if ($scriptalias or $scriptaliases != [])
|
2237 | 2225 | or ($aliases and $aliases != [])
|
|
2259 | 2247 | }
|
2260 | 2248 | }
|
2261 | 2249 |
|
2262 |
| - # Check if mod_headers is required to process $headers/$request_headers |
2263 |
| - if $headers or $request_headers { |
2264 |
| - if ! defined(Class['apache::mod::headers']) { |
2265 |
| - include apache::mod::headers |
2266 |
| - } |
2267 |
| - } |
2268 |
| - |
2269 |
| - # Check if mod_filter is required to process $filters |
2270 |
| - if $filters { |
2271 |
| - if ! defined(Class['apache::mod::filter']) { |
2272 |
| - include apache::mod::filter |
2273 |
| - } |
2274 |
| - } |
2275 |
| - |
2276 | 2250 | # Check if mod_env is required and not yet loaded.
|
2277 | 2251 | # create an expression to simplify the conditional check
|
2278 | 2252 | $use_env_mod = $setenv and ! empty($setenv)
|
|
2487 | 2461 | }
|
2488 | 2462 |
|
2489 | 2463 | # Template uses:
|
2490 |
| - # - $access_log |
| 2464 | + # - $_access_logs |
2491 | 2465 | # - $_access_log_env_var
|
2492 | 2466 | # - $access_log_destination
|
2493 | 2467 | # - $_access_log_format
|
2494 | 2468 | # - $_access_log_env_var
|
2495 |
| - # - $access_logs |
2496 |
| - if $access_log or $access_logs { |
| 2469 | + if !empty($_access_logs) { |
2497 | 2470 | concat::fragment { "${name}-access_log":
|
2498 | 2471 | target => "${priority_real}${filename}.conf",
|
2499 | 2472 | order => 100,
|
|
2534 | 2507 |
|
2535 | 2508 | # Template uses:
|
2536 | 2509 | # - $headers
|
2537 |
| - if $headers and ! empty($headers) { |
| 2510 | + if ! empty($headers) and $ensure == 'present' { |
| 2511 | + include apache::mod::headers |
| 2512 | + |
2538 | 2513 | concat::fragment { "${name}-header":
|
2539 | 2514 | target => "${priority_real}${filename}.conf",
|
2540 | 2515 | order => 140,
|
|
2544 | 2519 |
|
2545 | 2520 | # Template uses:
|
2546 | 2521 | # - $request_headers
|
2547 |
| - if $request_headers and ! empty($request_headers) { |
| 2522 | + if ! empty($request_headers) and $ensure == 'present' { |
| 2523 | + include apache::mod::headers |
| 2524 | + |
2548 | 2525 | concat::fragment { "${name}-requestheader":
|
2549 | 2526 | target => "${priority_real}${filename}.conf",
|
2550 | 2527 | order => 150,
|
|
2613 | 2590 | # - $rewrite_rule
|
2614 | 2591 | # - $rewrite_cond
|
2615 | 2592 | # - $rewrite_map
|
2616 |
| - if $rewrites or $rewrite_rule { |
| 2593 | + if (! empty($rewrites) or $rewrite_rule) and $ensure == 'present' { |
| 2594 | + include apache::mod::rewrite |
| 2595 | + |
2617 | 2596 | concat::fragment { "${name}-rewrite":
|
2618 | 2597 | target => "${priority_real}${filename}.conf",
|
2619 | 2598 | order => 190,
|
|
2899 | 2878 | # - $modsec_disable_tags
|
2900 | 2879 | # - $modsec_body_limit
|
2901 | 2880 | # - $modsec_audit_log_destination
|
2902 |
| - if $modsec_disable_vhost or $modsec_disable_ids or $modsec_disable_ips or $modsec_disable_msgs or $modsec_disable_tags or $modsec_audit_log_destination { |
| 2881 | + if $modsec_disable_vhost or $modsec_disable_ids or !empty($modsec_disable_ips) or $modsec_disable_msgs or $modsec_disable_tags or $modsec_audit_log_destination { |
2903 | 2882 | concat::fragment { "${name}-security":
|
2904 | 2883 | target => "${priority_real}${filename}.conf",
|
2905 | 2884 | order => 320,
|
|
2909 | 2888 |
|
2910 | 2889 | # Template uses:
|
2911 | 2890 | # - $filters
|
2912 |
| - if $filters and ! empty($filters) { |
| 2891 | + if ! empty($filters) and $ensure == 'present' { |
| 2892 | + include apache::mod::filter |
| 2893 | + |
2913 | 2894 | concat::fragment { "${name}-filters":
|
2914 | 2895 | target => "${priority_real}${filename}.conf",
|
2915 | 2896 | order => 330,
|
|
2919 | 2900 |
|
2920 | 2901 | # Template uses:
|
2921 | 2902 | # - $jk_mounts
|
2922 |
| - if $jk_mounts and ! empty($jk_mounts) { |
| 2903 | + if !empty($jk_mounts) and $ensure == 'present' { |
| 2904 | + include apache::mod::jk |
| 2905 | + |
2923 | 2906 | concat::fragment { "${name}-jk_mounts":
|
2924 | 2907 | target => "${priority_real}${filename}.conf",
|
2925 | 2908 | order => 340,
|
|
0 commit comments