Merge lp:~gnuoy/charms/trusty/percona-cluster/sstpasswd into lp:~le-charmers/charms/trusty/percona-cluster/leadership-election

Proposed by Liam Young
Status: Superseded
Proposed branch: lp:~gnuoy/charms/trusty/percona-cluster/sstpasswd
Merge into: lp:~le-charmers/charms/trusty/percona-cluster/leadership-election
Diff against target: 22 lines (+7/-3)
1 file modified
hooks/percona_hooks.py (+7/-3)
To merge this branch: bzr merge lp:~gnuoy/charms/trusty/percona-cluster/sstpasswd
Reviewer Review Type Date Requested Status
Edward Hope-Morley Needs Fixing
Review via email: mp+258857@code.launchpad.net

This proposal has been superseded by a proposal from 2015-05-13.

To post a comment you must log in.
Revision history for this message
Edward Hope-Morley (hopem) wrote :

I'm surprised this has not given is more issue in production. So, unfortunately the way you are doing things here will break the case where no password is provided in config.yaml sst-passwd and is therefore auto-generated and shared on the peer relation. A better option might be to add a new param to get_mysl_password() e.g. create_if_none=False so that we check the peer rel and only create a new one if create_if_none if True which we would be the case only if we were the leader. FTR get_mysql_password() is also called from install() and config_changed() so will need protection there too.

review: Needs Fixing

Unmerged revisions

79. By Liam Young

Fix le bug where non-leaders try and migrate on disk passwords to peer relation and explode

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/percona_hooks.py'
2--- hooks/percona_hooks.py 2015-05-11 10:23:34 +0000
3+++ hooks/percona_hooks.py 2015-05-12 10:34:23 +0000
4@@ -419,11 +419,15 @@
5 'res_mysql_monitor': 'ocf:percona:mysql_monitor'}
6 db_helper = get_db_helper()
7 cfg_passwd = config('sst-password')
8- sstpsswd = db_helper.get_mysql_password(username='sstuser',
9- password=cfg_passwd)
10+ if is_elected_leader(LEADER_RES):
11+ # get_mysql_password creates the user if it doesn't exist and updates
12+ # peer or db settings. Only the leader shoud do that.
13+ sstpsswd = db_helper.get_mysql_password(username='sstuser',
14+ password=cfg_passwd)
15+
16 resource_params = {'res_mysql_vip': vip_params,
17 'res_mysql_monitor':
18- RES_MONITOR_PARAMS % {'sstpass': sstpsswd}}
19+ RES_MONITOR_PARAMS % {'sstpass': cfg_passwd}}
20 groups = {'grp_percona_cluster': 'res_mysql_vip'}
21
22 clones = {'cl_mysql_monitor': 'res_mysql_monitor meta interleave=true'}

Subscribers

People subscribed via source and target branches