Merge lp:~pjdc/charms/trusty/postgresql/no-restart-on-upgrade into lp:charms/trusty/postgresql

Proposed by Paul Collins
Status: Merged
Merged at revision: 112
Proposed branch: lp:~pjdc/charms/trusty/postgresql/no-restart-on-upgrade
Merge into: lp:charms/trusty/postgresql
Diff against target: 40 lines (+4/-5)
1 file modified
hooks/hooks.py (+4/-5)
To merge this branch: bzr merge lp:~pjdc/charms/trusty/postgresql/no-restart-on-upgrade
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Review via email: mp+249022@code.launchpad.net

Description of the change

upgrade_charm(): prevent install() from unconditionally restarting postgres;
requires_restart(): log missing saved_config

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

Looks good & tests are still passing. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/hooks.py'
2--- hooks/hooks.py 2015-01-13 16:14:28 +0000
3+++ hooks/hooks.py 2015-02-09 00:29:26 +0000
4@@ -286,8 +286,7 @@
5
6 saved_config = local_state.get('saved_config', None)
7 if not saved_config:
8- # No record of postgresql.conf state, perhaps an upgrade.
9- # Better restart.
10+ log("No record of postgresql.conf state. Better restart.")
11 return True
12
13 live_config = local_state.setdefault('live_config', {})
14@@ -1193,7 +1192,7 @@
15
16
17 @hooks.hook()
18-def install(run_pre=True):
19+def install(run_pre=True, force_restart=True):
20 if run_pre:
21 for f in glob.glob('exec.d/*/charm-pre-install'):
22 if os.path.isfile(f) and os.access(f, os.X_OK):
23@@ -1267,7 +1266,7 @@
24 # Ensure at least minimal access granted for hooks to run.
25 # Reload because we are using the default cluster setup and started
26 # when we installed the PostgreSQL packages.
27- config_changed(force_restart=True)
28+ config_changed(force_restart=force_restart)
29
30 snapshot_relations()
31
32@@ -1284,7 +1283,7 @@
33 and block-storage-broker services. These steps are generalised in the
34 README as well.
35 """
36- install(run_pre=False)
37+ install(run_pre=False, force_restart=False)
38 snapshot_relations()
39 version = pg_version()
40 cluster_name = hookenv.config('cluster_name')

Subscribers

People subscribed via source and target branches

to all changes: