puppetlabs-apache icon indicating copy to clipboard operation
puppetlabs-apache copied to clipboard

@param rewrite_rule ignored in apache::vhost due to changed default value of @param rewrite

Open janit42 opened this issue 3 years ago • 0 comments

Describe the Bug

a rewrite rule for the apache::vhost type defined in $rewrite_rule is ignored since 7b22dae and not written to the vhost file if $rewrites is not explicitly set to undef.

Expected Behavior

rewrite rules defined in $rewrite_rule of the apache::vhost type should be written to the vhost file with the default value of $rewrites

Additional Context

In https://github.com/puppetlabs/puppetlabs-apache/commit/7b22dae24ff4a04f9258362f90bf6a2151c24a23 the default value for $rewrites was changed from undef to [] in manifests/vhost.pp. This results in templates_vhost/_rewrite.erb always evaluating to false (boolean check on an empty array variable is still true) unless $rewrites is explicitly set to undef. This results in the content of $rewrite_rule being ignored.

I'm not sure if this is the intended behavior.

A possible solution would be to change the default for $rewrites back to undef or to extend the checks in /templates/vhost/_rewrite.erb#L1 and /templates/vhost/_rewrite.erb#L41 to also test for an empty array.

janit42 avatar Sep 20 '22 14:09 janit42