Skip to content

Automatically include modules used in vhost directories #2255

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

Merged
merged 4 commits into from
Jul 4, 2022

Conversation

ekohl
Copy link
Collaborator

@ekohl ekohl commented Jun 28, 2022

The data passed to the directories parameter of apache::vhost often implies a module should be present. This change inspects the passed data and automatically includes modules if needed. This makes it easier to use via Hiera while disabling all default mods.

Because of this change one acceptance test becomes obsolete: it no longer fails and just works.

To make this easier the data type is simplified. This means users need to be a bit stricter about their input, but they need to worry less about including the right modules.

This replaces #2250.

@puppet-community-rangefinder
Copy link

apache::mod::proxy_ajp is a class

Breaking changes to this file WILL impact these 1 modules (exact match):

apache::mod::proxy_balancer is a class

Breaking changes to this file WILL impact these 1 modules (exact match):

apache::mod::proxy_connect is a class

Breaking changes to this file WILL impact these 1 modules (exact match):

apache::mod::proxy_fcgi is a class

Breaking changes to this file WILL impact these 2 modules (exact match):
Breaking changes to this file MAY impact these 1 modules (near match):

apache::mod::proxy_html is a class

Breaking changes to this file WILL impact these 1 modules (exact match):

apache::mod::proxy_http is a class

Breaking changes to this file WILL impact these 10 modules (exact match):

apache::mod::proxy_wstunnel is a class

Breaking changes to this file WILL impact these 2 modules (exact match):

apache::vhost is a type

Breaking changes to this file WILL impact these 128 modules (exact match):
Breaking changes to this file MAY impact these 35 modules (near match):

This module is declared in 174 of 579 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

@david22swan
Copy link
Member

@ekohl Look's like another few spec failures have shown their heads, almost there 🤞

@ekohl ekohl force-pushed the include-mods-in-directories branch from 2081493 to 10a3e5f Compare June 28, 2022 10:24
@ekohl
Copy link
Collaborator Author

ekohl commented Jun 28, 2022

Tests have been running for a long time. I suspect there is a failure in many cases which means it generates a ton of errors. I pushed a commit that massively reduces the spec tests so hopefully I get a faster result.

@ekohl
Copy link
Collaborator Author

ekohl commented Jun 28, 2022

Ah, it doesn't run the vhost tests on non-Debian. That's surprising since other code suggests it does run on that. Will update again.

@ekohl ekohl force-pushed the include-mods-in-directories branch 4 times, most recently from d31eae1 to 23f775a Compare June 28, 2022 14:17
@ekohl
Copy link
Collaborator Author

ekohl commented Jun 28, 2022

This is much easier to iterate on.

@ekohl ekohl marked this pull request as draft June 28, 2022 14:19
@ekohl
Copy link
Collaborator Author

ekohl commented Jun 28, 2022

I tried fixing it, but somehow it still doesn't recognize the param docs for gssapi:

manifests/vhost.pp - WARNING: No matching defined type parameter for documentation of apache::vhost::gssapi on line 1470 (check: parameter_documentation)
manifests/vhost.pp - WARNING: No matching defined type parameter for documentation of apache::vhost::gssapi on line 1470 (check: parameter_documentation)

@ekohl ekohl force-pushed the include-mods-in-directories branch from 23f775a to a7876e7 Compare June 28, 2022 14:30
@ekohl
Copy link
Collaborator Author

ekohl commented Jun 28, 2022

Well, that's green. Removing the temporary commit to see if it all fits together.

@ekohl ekohl force-pushed the include-mods-in-directories branch from a7876e7 to d21c139 Compare June 28, 2022 14:53
@david22swan
Copy link
Member

david22swan commented Jun 29, 2022

@ekohl Seems to be a few spec test failures left. All coming from the same section:

  1) apache::vhost os-independent items on scientific-6-x86_64  not everything can be set together... is expected to contain Concat::Fragment[rspec.example.com-directories] with content =~ /^\s+Allow from 127\.0\.0\.1$/
     Failure/Error:
       is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
         content: %r{^\s+Allow from 127\.0\.0\.1$},
       )
       expected that the catalogue would contain Concat::Fragment[rspec.example.com-directories]
     # ./spec/defines/vhost_spec.rb:2140:in `block (6 levels) in <top (required)>'
     # ./vendor/bundle/ruby/2.7.0/bin/rspec:23:in `load'
     # ./vendor/bundle/ruby/2.7.0/bin/rspec:23:in `<top (required)>'
     # /opt/hostedtoolcache/Ruby/2.7.6/x64/bin/bundle:23:in `load'
     # /opt/hostedtoolcache/Ruby/2.7.6/x64/bin/bundle:23:in `<main>'

Only appearing on scientific, oracle and redhat 6 so they didn't show when you cut to Ubuntu

@ekohl
Copy link
Collaborator Author

ekohl commented Jun 29, 2022

Ah yes, I only ran the quick tests with Debian enabled. Now with the full matrix we test a bit more. Looks like there are some tests there that verify behavior when the vhost is set to absent. Now that the whole directories concat fragment is only rendered when it's present, it's not in the catalog. I'll rewrite the test.

@ekohl
Copy link
Collaborator Author

ekohl commented Jun 29, 2022

Before moving it I'd like to merge #2256 because it makes the refactor easier.

@ekohl ekohl force-pushed the include-mods-in-directories branch from d21c139 to a396669 Compare June 29, 2022 12:15
@david22swan
Copy link
Member

@ekohl Look's like the spec test failures are still there

@ekohl
Copy link
Collaborator Author

ekohl commented Jun 29, 2022

I ended up wanting to do more refactors so I've split off yet another part in a more focused PR: #2257. Apologies for the scope blowing up, but I believe it makes it easier to maintain in the future.

@david22swan
Copy link
Member

No need to apologize, I'm liking all the changes

@ekohl ekohl mentioned this pull request Jul 4, 2022
ekohl added 3 commits July 4, 2022 11:28
This ensures the proxy module is always loaded at the right time.
This makes it easier to run with default mods disabled while still using
this mod.
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.
@ekohl ekohl force-pushed the include-mods-in-directories branch from a396669 to 3241a6d Compare July 4, 2022 09:30
@ekohl
Copy link
Collaborator Author

ekohl commented Jul 4, 2022

Rebased to resolve the conflicts. Let's see if the tests pass.

@ekohl ekohl marked this pull request as ready for review July 4, 2022 09:30
@ekohl
Copy link
Collaborator Author

ekohl commented Jul 4, 2022

I'm not quite sure why GH actions don't run.

The data passed to the directories parameter of apache::vhost often
implies a module should be present. This change inspects the passed data
and automatically includes modules if needed. This makes it easier to
use via Hiera while disabling all default mods.

Because of this change one acceptance test becomes obsolete: it no
longer fails and just works.
@ekohl ekohl force-pushed the include-mods-in-directories branch from 3241a6d to 040eab9 Compare July 4, 2022 10:08
Copy link
Member

@david22swan david22swan left a comment

Choose a reason for hiding this comment

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

LGTM

@david22swan
Copy link
Member

Ok, everything's gone green so I'm happy to merge.

@david22swan david22swan merged commit 3839c93 into puppetlabs:main Jul 4, 2022
@ekohl ekohl deleted the include-mods-in-directories branch July 4, 2022 10:57
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.

3 participants