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

Add feature to reload apache service when content of ssl files has changed #2157

Merged
merged 1 commit into from
Jul 26, 2021

Conversation

timdeluxe
Copy link
Contributor

This fixes issue MODULES-10847, which we also wanted to solve.

The solution with those helper files seems a bit odd, but the original ssl files could be managed by any means outside of the apache module or even outside of puppet, so this was the only way i could image to achieve it.

(Slightly offtopic: Let me add that this module gave me a love/hate relationship with spec/acceptance tests. First i blamed wrong tests to be the cause for failing, but in the end it was my own stupid code. Finally i could manage getting tests run green at my desktop - hope they will do in the modules CI setup as well.)

@timdeluxe timdeluxe requested a review from a team as a code owner June 10, 2021 13:31
@CLAassistant
Copy link

CLAassistant commented Jun 10, 2021

CLA assistant check
All committers have signed the CLA.

@puppet-community-rangefinder
Copy link

apache::mod::ssl is a class

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

apache::params is a class

Breaking changes to this file WILL impact these 16 modules (exact match):
Breaking changes to this file MAY impact these 11 modules (near 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 34 modules (near match):

This module is declared in 175 of 576 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.

@timdeluxe
Copy link
Contributor Author

Ah well, so many hours with tests and i oversaw the basics... 🙈 Please apologize!
Will fix and squash/rebase. No need to comment about this.

However if you have feedback to the feature itself, let me know.

@timdeluxe timdeluxe force-pushed the te_ssl_reload branch 5 times, most recently from bd14e2b to 649f7f5 Compare June 11, 2021 08:04
Copy link
Collaborator

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

I personally like a minimal impact on environments. Can it only manage the directory if the feature is enabled? Perhaps even purge the whole directory if it's disabled?

@timdeluxe
Copy link
Contributor Author

I personally like a minimal impact on environments. Can it only manage the directory if the feature is enabled? Perhaps even purge the whole directory if it's disabled?

@ekohl Before i answer to each of the code remarks, lets discuss this first, because those code remark discussions depend on that:

I struggled with exactly that question, but the reload thing should be a per-vhost-based thing. One should be able to have apache reloaded if the ssl files change for a vhost, but not for the other. At least that is my opinion. I need to manage the folder in ssl.pp then, because vhost.pp is a define and managing the folder there would lead to duplicate declarations. Also even if the reload is deactivated for default vhost and for the mod::ssl module, it still can be activated for a vhost and then the folder is required.

Or do we say that reload thing is a general setting and can't be changed on a per vhost base? (In that case your requested changes could be implemented)

@ekohl
Copy link
Collaborator

ekohl commented Jun 11, 2021

You're right that we should take it to a higher design level.

So we have a few options. The current one obviously. We can also introduce a global parameter.

Another is introducing a private class (like apache::mod::ssl::reload) that does the directory setup. Then in apache::vhost you can include it if it does need the reload.

The benefit is that mod_ssl doesn't need any modification. It also keeps it "lazy" in that you only get the additional directories if you do use the feature. The downside is that you can't purge/clean it up.

@timdeluxe
Copy link
Contributor Author

A private class is indeed a good idea, will try that, thanks!

However mod_ssl does need at least the file resources for the ssl files, because one could work with apache without using vhosts at all (extremly rare, but the module is widely spread, so we should not forget those people).

@timdeluxe timdeluxe force-pushed the te_ssl_reload branch 2 times, most recently from 3e3296b to 2987339 Compare June 14, 2021 09:07
@timdeluxe
Copy link
Contributor Author

On real world usage of my branch i found two further issues, which i now fixed: The puppet_ssl_dir was managed before apache was even installed and resulted in missing httpd_dir, so management of puppet_ssl_dir failed. Also even if the default-ssl vhost was set to absent, it still managed its certificate copy - this is also now fixed.

This PR still says @ekohl requested 1 change, however i can only find resolved conversations. Can someone help me?

@david22swan
Copy link
Member

@timdeluxe As stated above by @ekohl it looks like some of the reference has been deleted by your changes.
Could you get that added back for us? Otherwise we won't be able to merge.

@timdeluxe
Copy link
Contributor Author

@david22swan Sorry, missed that. Is fixed now.

@timdeluxe timdeluxe requested review from ekohl and removed request for a team June 29, 2021 09:25
@timdeluxe
Copy link
Contributor Author

timdeluxe requested review from ekohl and removed request for puppetlabs/modules 6 hours ago

Sorry, i am still confused by the github review process. It still shows a change requested by @ekohl, despite the fact that i resolved all conversations :-/
In my desperation i tried to resolve it by re-requesting the review by @ekohl, but that didn't solve it. Please help me, i am lost :-(

@david22swan
Copy link
Member

@timdeluxe Apologies, for that to disappear @ekohl must approve the PR.

@timdeluxe timdeluxe force-pushed the te_ssl_reload branch 2 times, most recently from 7d7bae1 to fd05fcf Compare July 2, 2021 14:39
Copy link
Collaborator

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Thanks! This is much easier to follow.

Copy link
Collaborator

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

@timdeluxe
Copy link
Contributor Author

Perhaps some example in https://github.com/puppetlabs/puppetlabs-apache/tree/main/examples would be nice?

I don't think that this feature is so important, that it needs an example. The ones who need it, will find it anyway...

Copy link
Collaborator

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Code wise 👍 but I see a few merge commits. Could you rebase?

@timdeluxe
Copy link
Contributor Author

Code wise 👍 but I see a few merge commits. Could you rebase?

After a fighting a bit with git logic (i always get knots in my brain) it is hopefully correctly done now.

Copy link
Collaborator

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

I started CI. I also hope someone else can review but 👍 from me. Thanks for getting this patch in good shape!

@timdeluxe
Copy link
Contributor Author

I started CI. I also hope someone else can review but 👍 from me. Thanks for getting this patch in good shape!

I hope the same. Also thanks to you for guiding me through it and spotting a lot of little things to improve.

@timdeluxe
Copy link
Contributor Author

Tests on RedHat failed not due to my code but due to mirrors not answering correctly - don't know if it is a temporary or a general problem, which can be fixed :/

@ekohl
Copy link
Collaborator

ekohl commented Jul 23, 2021

That's a known issue (#2171 tries to look into it)

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

Will confer with another team member first but look's good to merge.

@david22swan david22swan merged commit f6fa483 into puppetlabs:main Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants