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

fix rewrite rules being ignored

Open trefzer opened this issue 3 years ago • 1 comments

In 7b22dae 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.

closes: #2318

trefzer avatar Oct 12 '22 07:10 trefzer

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 12 '22 07:10 CLAassistant

@ekohl I agree, but since the logic is in a template we would need to check the final content in the file which I have no idea how to do with spec test. (anyone who nows please let me know !)

trefzer avatar Oct 30 '22 12:10 trefzer

I would probably take this example: https://github.com/puppetlabs/puppetlabs-apache/blob/77255d652212466ae5dbc81b1381936794c50dbf/spec/defines/vhost_spec.rb#L1723-L1736 Then copy it and pass some parameters that triggers the behavior you want to test.

Note you can also test the whole file:

it {
  is_expected.to contain_concat__fragment('rspec.example.com-rewrite').with_content <<~CONTENT
    Here you can write the full content
    And use multiple lines
  CONTENT
}

ekohl avatar Nov 04 '22 11:11 ekohl

@trefzer Hey sorry to bother you, just checking in on when you'll have time to finish with the sped test?

david22swan avatar Jan 16 '23 10:01 david22swan

Good good good

Should be released by end of day

david22swan avatar Feb 10 '23 12:02 david22swan