Merge lp:~hloeung/ubuntu-repository-cache/apache2-restart-on-mpm-changes into lp:ubuntu-repository-cache

Proposed by Haw Loeung
Status: Merged
Approved by: Haw Loeung
Approved revision: 295
Merged at revision: 293
Proposed branch: lp:~hloeung/ubuntu-repository-cache/apache2-restart-on-mpm-changes
Merge into: lp:ubuntu-repository-cache
Diff against target: 34 lines (+17/-0)
1 file modified
reactive/ubuntu-repository-cache.py (+17/-0)
To merge this branch: bzr merge lp:~hloeung/ubuntu-repository-cache/apache2-restart-on-mpm-changes
Reviewer Review Type Date Requested Status
Paul Collins lgtm Approve
Canonical IS Reviewers Pending
Review via email: mp+394990@code.launchpad.net

Commit message

Restart apache2 on MPM changes as required

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

294. By Haw Loeung

Fixed to clear flag on restart

Revision history for this message
Paul Collins (pjdc) :
review: Needs Fixing
Revision history for this message
Paul Collins (pjdc) wrote :

My inline comments vanished somewhere, but for the record they were:
 - clear_flag
 - not all settings require a restart (confusingly, Apache docs refer to a graceful as "restart"...)

295. By Haw Loeung

Fixed to restrict to limited set of MPM settings that actually requires a full restart

Revision history for this message
Paul Collins (pjdc) :
review: Approve (lgtm)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 293

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'reactive/ubuntu-repository-cache.py'
2--- reactive/ubuntu-repository-cache.py 2020-12-03 04:57:38 +0000
3+++ reactive/ubuntu-repository-cache.py 2020-12-08 00:26:18 +0000
4@@ -40,6 +40,15 @@
5 reactive.clear_flag('nagios-nrpe.configured')
6
7
8+@reactive.when_any(
9+ 'config.changed.apache2_mpm_type',
10+ 'config.changed.apache2_mpm_threadlimit',
11+ 'config.changed.apache2_mpm_serverlimit',
12+)
13+def apache2_restart_required():
14+ reactive.set_flag('ubuntu-repository-cache.apache2-restart-required')
15+
16+
17 @reactive.when('ubuntu-repository-cache.installed')
18 @reactive.when_not('ubuntu-repository-cache.configured')
19 def configure_services():
20@@ -71,6 +80,14 @@
21 hookenv.relation_set(relation_id=relation_id, relation_settings=settings)
22
23
24+@reactive.when('ubuntu-repository-cache.configured')
25+@reactive.when('ubuntu-repository-cache.apache2-restart-required')
26+def apache2_restart():
27+ LOG('Restarting apache2 as MPM settings have changed')
28+ host.service_restart('apache2')
29+ reactive.clear_flag('ubuntu-repository-cache.apache2-restart-required')
30+
31+
32 @reactive.hook('upgrade-charm')
33 def upgrade_charm():
34 '''Handle charm updates'''

Subscribers

People subscribed via source and target branches