Skip to content
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

Updates to allow multiple rewrite rules and rewrite rule/condition pairs #373

Closed
wants to merge 39 commits into from

Conversation

amvapor
Copy link
Contributor

@amvapor amvapor commented Sep 21, 2013

I believe I have setup tests and documentation correctly, but would love any comments to make this ready to merge.

@blkperl
Copy link
Contributor

blkperl commented Sep 21, 2013

Hi @amvapor

Is this meant to replace the old rewrite variables? Please add a validate_hash() in vhost.pp for the new rewrites param.

@amvapor
Copy link
Contributor Author

amvapor commented Sep 21, 2013

Yes, the intention is to create an entirely different way to handle rewrites, one where multiple rewrite rule/condition sets can be setup. I have just committed an addition of the validate_hash() for the rewrites hash but I don't have my full dev environment to run full test suite locally.

@blkperl
Copy link
Contributor

blkperl commented Sep 21, 2013

Spec tests are failing now. Can you add deprecation warnings to the old rewrite variables?

@amvapor
Copy link
Contributor Author

amvapor commented Sep 21, 2013

Yes, I see the failing test, I will get it all up to snuff in my proper development environment on Monday. I may play with it further this weekend, but I'm not counting on it.

@amvapor
Copy link
Contributor Author

amvapor commented Sep 23, 2013

I think this is ready to merge now, I'd appreciate any comments on the last commit however, I can't seem to see a good way to validate all hashes in an array.

@blkperl
Copy link
Contributor

blkperl commented Sep 24, 2013

Can you add warnings for the old params?

@amvapor
Copy link
Contributor Author

amvapor commented Sep 25, 2013

Shouldn't be a problem. will do today.

@amvapor
Copy link
Contributor Author

amvapor commented Sep 26, 2013

Sorry for the delay, but I can't find a great way to test the warnings, especially in the rspec tests.

@blkperl
Copy link
Contributor

blkperl commented Sep 26, 2013

That's fine warnings don't need to be tested.


# Deprecated backwards-compatibility
if $rewrite_rule {
warning('Apache::Vhost: parameter rewrite_rule is depricated in favor of rewrites')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deprecated is spelled wrong

@blkperl
Copy link
Contributor

blkperl commented Sep 26, 2013

Does rewrite_rule and rewrite_cond still work after this PR? If not then this has to go in a major release otherwise this can go in the next minor release.

@amvapor
Copy link
Contributor Author

amvapor commented Sep 26, 2013

the existing rewrite_rule and rewrite_cond continue to work. But if rewrites is defined, they stop working. You can see this logic in templates/vhost/_rewrites.erb

@blkperl
Copy link
Contributor

blkperl commented Oct 1, 2013

@igalic Can you do a review?

@igalic
Copy link
Contributor

igalic commented Oct 1, 2013

sure! On it.

@igalic
Copy link
Contributor

igalic commented Oct 1, 2013

I have two criticisms:

  1. Some of the examples are weak leaning on bad: I'm not a bad a fan of (.*) in RewriteRules when you do not actually use what you captured. In such cases it's enough to check for ^: everything has a beginning, even empty strings, and no need to waste CPU or memory going to the end of that string (note that the HTTP RFC gives no limit for the length of an URI.
  2. The tests should test the examples you give and document to be truly useful.

@amvapor
Copy link
Contributor Author

amvapor commented Oct 9, 2013

@igalic Thanks for the review, I appreciate it

Regarding point 1. I just reformatted an existing example to work with the new rewrites format. I'm not sure if I should be changing the example's intended use.

Regarding point 2. I will be committing a change to actually do a valid test shortly. Should all examples be tested? or only a subset?

@igalic
Copy link
Contributor

igalic commented Oct 10, 2013

@amvapor can you please look at the author (Arnold and root..) in 831be33 and fix it

@igalic
Copy link
Contributor

igalic commented Oct 10, 2013

@amvapor you may want to take another look at the author and committer fields (it says arnold and root) in that last commit (831be33) and fix them accordingly.

@amvapor
Copy link
Contributor Author

amvapor commented Nov 14, 2013

I'm pretty sure that makes this reasonable to merge. If it doesn't please help me out with a link or two.

@igalic
Copy link
Contributor

igalic commented Nov 14, 2013

I'd rebase it against master, then squash the commits down to a reasonable amount.
See http://git-scm.com/book/en/Git-Tools-Rewriting-History for how to do that.

@igalic
Copy link
Contributor

igalic commented Nov 18, 2013

any news on this?

Aaron Hicks and others added 12 commits November 18, 2013 22:47
make all matches and notmatches arrays of regex and exact match strings

...because consistency and explicitness
Altered changed ssl_proxyengine to match form of other SSL parameters.

Fixed unescaped + in regex
…tra_newlines

Remove extra empty lines in _directories template
Adding support for another mod_wsgi parameter (WSGIPythonPath)
…ng grouping and commenting

Changing the syntax of the directives. Now the rewrite directive is more intuitive and is consistent with other directives (i.e: aliases)

filling out the documentation a little more thoroughly

filling out the documentation a little more thoroughly

adding validation to the rewrites param

adding better tests for the new rewrite settings

make sure at least the first rewrite is a valid hash

adding warnings for depricated parameters

fixing spelling mistake

setting up real tests of rewrites

Setting up the ability to do multiple rewrites and conditions. Allowing grouping and commenting

Changing the syntax of the directives. Now the rewrite directive is more intuitive and is consistent with other directives (i.e: aliases)

filling out the documentation a little more thoroughly

fixing a misstype

renaming the rewrite_conds and rewrite_rules parameters to be singular to maintain consistency with previous standard
added peruser and event mpms

Workaround for apxs-loaded modules

On some OSes (FreeBSD) apxs tool is used to put LoadModule directives
into httpd.conf during apache package (and apache modules)
insallation/reinstallation. The apxs expects some LoadModule directives
to be already present in httpd.conf (they may be commented-out) in order
to decide where to put its own directives.

This PR puts fake LoadModule directive (commented out) to httpd.conf.
The $apxs_workaround boolean parameter in apache class decides, whether
to use this workaround or not. This is used on FreeBSD, where apxs is
used by ports package provider (and perhaps all other). Without this,
the apache installation/reinstallation/deinstallation as well as
installation of additional modules would fail.

This PR was created in order to split puppetlabs#342 into smaller parts to make
review process easier, see
puppetlabs#342 (comment)

Remove AllowOverride header for non-directories

When adding a dir with a different provider than directory (e.g. files,
or location), the AllowOverride header still added. This causes a
warning in apache.

Add unit tests

Fixed a typo. The directory provider should be lower case to match the manifests.

allow to choose the mpm_event mod from the init.pp

added a mod/event.pp manifest and edited the spec test
of the prefork/worker/event modules.

Add initial support for nss module (no directives in vhost template yet)

added $server_root parameter

Previously, the $httpd_dir was used as ServerRoot in httpd.conf
template. On some installations httpd_dir is not same as ServerRoot,
for example on FreeBSD apache22 (installed via ports) has ServerRoot set
to /usr/local by default.

This PR adds $server_root parameter to apache::params. Its purpose is to
be substituted in httpd.conf as ServerRoot. This parameter is used
in puppetlabs#342. The purpose of the whole thing is to plit puppetlabs#342 into smaller
parts to make review process easier, see
puppetlabs#342 (comment)

Allow apache::mod to specify module id and path

Add $id, $path and $lib_path parameters to apache::mod. These parameters
are used in puppetlabs#342. The purpose of the whole thing is to plit puppetlabs#342 into
smaller parts to make review process easier, see
puppetlabs#342 (comment)

This PR covers all changes introduced by puppetlabs#271 to manifests/mod.pp. I
just don't have test/mod_load_params.pp as in puppetlabs#271.

Add new params to apache::mod::mime class

This changeset adds $mime_support_package and $mime_types_config
parameters to class `apache::mod::mime`. Their purpose is following:

- $mime_support_package - install this package, as it provides mime.conf
  file (definition of mime types used by mod_mime),
- $mime_types_config - used to substitute TypesConfig in
  mod/mime.conf.erb template.

This PR was created in order to plit puppetlabs#342 into smaller
parts to make review process easier, see
puppetlabs#342 (comment)

Include mime if ssl is in use.

Without the default_mods we still try to setup an SSL vhost that fails
because AddType is used in the template.  Rather than trying to make
AddType conditional on the inclusion of the class we just require mime
as a standard mod no matter what you say.

Wrap the event test in a check for FreeBSD.

It seems this only works on FreeBSD currently.  In the future
we'll rework testing to test for 2.2 vs 2.4 or something.
@amvapor
Copy link
Contributor Author

amvapor commented Nov 19, 2013

@igalic I've either done it, or I've seriously messed up this branch... if it doesn't work this time, I'll close this pull request and applying the patch on a fresh branch of upstream master as a single commit and opening a new pull request.

@igalic
Copy link
Contributor

igalic commented Nov 19, 2013

We still have ~39 commits on this branch. Please rebase against master:

git remote add upstream git://github.com/puppetlabs/puppetlabs-apache
git remote update
git rebase upstream/master

And then squash your commits:

git rebase -i HEAD~number_of_your_commits

@paul91
Copy link

paul91 commented Nov 25, 2013

Any progress? This feature would be really helpful.

@igalic
Copy link
Contributor

igalic commented Nov 25, 2013

@amvapor hasn't replied in quite some time. I can attempt to do the merge/squash myself if we don't here anything from them until tomorrow.

@igalic
Copy link
Contributor

igalic commented Nov 27, 2013

@amvapor I've merge --squashed your entire branch one commit https://github.com/igalic/puppetlabs-apache/commit/5830d0668bbd630f4c72f391559ebcfcbd85e888. Unfortunately, git did not preserve the authorship, except in the commit message, so I'm a little unhappy

@amvapor
Copy link
Contributor Author

amvapor commented Nov 27, 2013

I'm getting lost on what's wrong and what I need to do to correct it, I squashed my commits down into amvapor@e8b1ea7 and it should be able to be merged. I don't particularly care about the authorship being in my name or not.

@igalic
Copy link
Contributor

igalic commented Nov 27, 2013

Either you force-push (git push -f) into the branch on github that makes up this pull request, or you close this one and create a new pull request from amvapor@e8b1ea7

@igalic
Copy link
Contributor

igalic commented Dec 5, 2013

@amvapor what's the status? Can you update this pull request, or close it and create one from amvapor@e8b1ea7 ?

@amvapor
Copy link
Contributor Author

amvapor commented Dec 5, 2013

@igalic Just in the middle of some deployments, I will address this by end of week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants