-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
added redirect match support #499
Conversation
@igalic Sorry for the delay |
'404', | ||
], | ||
:redirectmatch_regexp => [ | ||
'/\\.git(/.*|$)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's one \ too many. From the looks of the travis build error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's weird, I have that configuration working on an apache virtualhost:
Redirect rules
RedirectMatch 404 /.git(/.*|$)
Unfortunately the tests are breaking on this. Can I ask you to take a look at travis? It looks like it'll be an easy one to fix, just have to tweak the test then "rake spec" to test it. |
Removed the extra slash and it works on apache also :squirrel: |
Do I have to do something to refresh the test? Travis is using the same code I think |
I'd squash and force-push those two commits,
|
Done |
But it's still failing, https://travis-ci.org/puppetlabs/puppetlabs-apache/jobs/14568417#L1124 |
I'm a little confused by the implementation of this. So the intention is that the full redirect text (regex AND destination) are added to I'm curious about why the different implementation than the redirect params, which break out source and dest. Seems like the redirect params should be consistent between Redirect and RedirectMatch. |
I will need some help here, I can't make that test work, it's always failing no matter how I escape the characters, I'm using grep and it works. How does this test make the matching expression checking? Is there I way I can test it by hand? Every rake spec test takes about 10 minutes on my computer |
Any help? |
I'm looking at this now. |
first off, this is how to run the spec tests:
|
next, test rules here http://rubular.com/ |
diff --git spec/defines/vhost_spec.rb spec/defines/vhost_spec.rb
index 1bd1aff..2e3a03e 100644
--- spec/defines/vhost_spec.rb
+++ spec/defines/vhost_spec.rb
@@ -1002,6 +1002,7 @@ describe 'apache::vhost', :type => :define do
end
describe 'redirect match rules' do
let :params do
+ ## XXX As mentioned above, rspec-puppet drops constructs like $1 and makes it hard to correctly escape \.
default_params.merge({
:redirectmatch_status => [
'404',
@@ -1012,7 +1013,7 @@ describe 'apache::vhost', :type => :define do
})
end
- it { should contain_file("25-#{title}.conf").with_content %r{ RedirectMatch 404 /\\\.git(/\.*|$)} }
+ it { should contain_file("25-#{title}.conf").with_content %r{ RedirectMatch 404 } }
end
describe 'without a status' do
let :params do and the test:
|
But, in general, and I'm sorry I'm saying this only now: I have to agree with @kclair: The parameters should be a list of hashes that break everything up, analogous to redirects, and analogous to all other directives. |
Perhaps it would be even better to do this analogous to the multiple rewrites (#373) patch. |
i'm not sure that i agree that it is analogous to rewrites because the directives (Rewrite and RewriteMatch) are actually different. To consolidate them would necessitate either a flag to indicate it's a RewriteMatch rather than a Rewrite, or trying to auto-detect a regex (ugh!). |
Hello again Sorry I didn't really understand your response. I see you've removed the regular expresion and the test went fine. I did the same at my computer and it works also. Do you want me to do that? |
Yes. For now, please do that. This is a bug in rspec-puppet |
When managing directories (or locations, files) through the `directories` parameter the resulting vhost configuration file contains a few empty lines too many. This cleans up these unnecessary empty lines, leaving just one between Directory blocks. This is a purely cosmetic change.
…er is used to specify additional directories to search for Python modules as described here: https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIPythonPath
(#479) Extend the _aliases.erb template so that the list of hashes in `apache::vhost`'s `aliases` parameter can contain the usual `alias` hashes but also `aliasmatch` hashes, which get translated to `AliasMatch` directives. Includes basic spec tests and updated documentation in README.md. Note that these spec tests are currently only skeletons because rspec-puppet drops constructs like '$1'. See the entries marked XXX.
Don't implicitly add a trailing slash to the path components of ScriptAlias directives. Includes updated spec tests. Fixes issue #489.
Remove the `authnz_ldap` key from $mod_packages in `apache::params` so an installation of the non-existent package `libapache2-mod-authz-ldap` is not attempted. Properly manage the `authnz_ldap.conf` file template and set the `LDAPVerifyServerCert` directive according to $verifyServerCert in `apache::mod::authnz_ldap`. Also update spec tests accordingly. This fixes only the superficial problems in issue #494. Better support for mod_ldap and mod_authnz_ldap is required, as discussed there.
add support for overriding ErrorDocument settings in both, vhost and directory context. With documentation and tests included this fixes #474
…edirect_match_support
…bs-apache into redirect_match_support Conflicts: spec/defines/vhost_spec.rb
Looks like a few other commits snuck in, can you rebase this against master. |
Looks like you submitted a second PR for this in #521. I'll close this one then |
Please check it now