-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Stricter data types and better module inclusion in vhost.pp #2250
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
Conversation
I included some of these changes in #2251 so perhaps that should be merged before this and then I can rebase. |
d57be7f
to
d1d8bc4
Compare
d1d8bc4
to
dd2b2b9
Compare
So the scope of this PR expanded a bit. It continues the trend that #2251 started. I've tried to keep it reviewable by having small commits. |
4dfbdab
to
256cb0f
Compare
256cb0f
to
da6ba3b
Compare
@ekohl Look's like the error is coming from
Think this is the only one, just seems to trigger a lot of tests |
This also implements a real test on the rendered template. It appears it was passing in something invalid ever since it was introduced in f1d64a0.
There is no need to check if the variables are true because the data type doesn't allow anything that evaluates to false. The logic to include it is also moved to the template which makes it easier to follow the logic. The same is applied to the template.
The data type only allows an array for scriptaliases so there is no need to check for the type. It is also checked at in vhost.pp that the value is set so there's no need to repeat that logic in the template.
This is now only included if docroot evaluates to true. The template does suggest that it should be `($docroot or $virtual_docroot)` but this remains compatible with the previous code.
The apache::mod::mime inclusion is dropped since apache::mod::ssl already includes it (since fc8fee7) and apache/vhost/_ssl.erb does not use AddType.
The data type does not allow a value that evaluates to false so no need ot check for it.
This ensures the proxy module is always loaded at the right time.
This tightens the data type to a simple array of hashes (as the parameter documentation suggests). This allows the logic to be simpler. Because of this, it is now fairly easy to include the correct modules if needed. Some options are implemented but there are more which could be automatically included.
da6ba3b
to
18eed8e
Compare
Yes, I had some trouble finding all instances. I do wonder how it ever worked. It was introduced in f1d64a0, but it doesn't look like it ever produced anything valid by passing a plain string. Let's see if this version is better. I also had to fix a test related to directories. |
The rubocop violation looks weird to me. Possibly an issue with Rubocop? I don't quite see it. Edit: and the acceptance test now on longer fails because it automatically loads the right modules. Should I drop the test? I'm not sure this should be the expected behavior. |
@ekohl In regards to the acceptance test....... it should probably be removed now yes if the behaviour it is expected to catch will no longer occur with your improvement in place. In regards to the Rubocop error........ Rubocop is just being annoying. Took a look and if you move aliases up so that it is not immediately followed by |
I think I'll pull out the last 2 patches to their own PR. Would it make sense to even make it 3 PRs? The first commit, then a series of patches to localize the imports and then a third for the last 2 commits? |
If you're willing to separate them out into three then that does sound good to me yes. |
Setting this back to a draft. I've submitted #2253 as a first PR. Once it's merged I'll submit the next. |
Part 2: #2254 |
And the last part: #2255 |
There is no need to call defined() before calling include since include handles it already.
It also consistently checks if $ensure is set to present before including modules.