Merge lp:~ahasenack/charms/precise/postgresql/postgresql-fix-recovery-conf into lp:charms/postgresql

Proposed by Andreas Hasenack
Status: Merged
Merged at revision: 84
Proposed branch: lp:~ahasenack/charms/precise/postgresql/postgresql-fix-recovery-conf
Merge into: lp:charms/postgresql
Diff against target: 17 lines (+3/-1)
1 file modified
hooks/hooks.py (+3/-1)
To merge this branch: bzr merge lp:~ahasenack/charms/precise/postgresql/postgresql-fix-recovery-conf
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Review via email: mp+204576@code.launchpad.net

Commit message

Include streaming_replication when writing out the recovery.conf file so that primary_conninfo gets added to it and replication can work.

Description of the change

Include streaming_replication when writing out the recovery.conf file so that primary_conninfo gets added to it and replication can work.

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

I've already got this waiting in https://code.launchpad.net/~stub/charms/precise/postgresql/pg93/+merge/202841. I'll land this patch though and resolve conflicts since this bug will block people.

review: Approve
Revision history for this message
Stuart Bishop (stub) wrote :

This didn't get picked up earlier, as there was no actual test that data was actually flowing from master to slave. My branch adds a test for this, so no need for one here.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/hooks.py'
--- hooks/hooks.py 2014-01-31 12:12:51 +0000
+++ hooks/hooks.py 2014-02-03 21:14:51 +0000
@@ -628,10 +628,12 @@
628 old_recovery_conf = None628 old_recovery_conf = None
629629
630 charm_dir = hookenv.charm_dir()630 charm_dir = hookenv.charm_dir()
631 streaming_replication = hookenv.config('streaming_replication')
631 template_file = "{}/templates/recovery.conf.tmpl".format(charm_dir)632 template_file = "{}/templates/recovery.conf.tmpl".format(charm_dir)
632 recovery_conf = Template(open(template_file).read()).render({633 recovery_conf = Template(open(template_file).read()).render({
633 'host': master_host,634 'host': master_host,
634 'password': local_state['replication_password']})635 'password': local_state['replication_password'],
636 'streaming_replication': streaming_replication})
635 log(recovery_conf, DEBUG)637 log(recovery_conf, DEBUG)
636 host.write_file(638 host.write_file(
637 os.path.join(postgresql_cluster_dir, 'recovery.conf'),639 os.path.join(postgresql_cluster_dir, 'recovery.conf'),

Subscribers

People subscribed via source and target branches