Merge lp:~niedbalski/charms/trusty/percona-cluster/fix-default-password-grant into lp:~openstack-charmers-archive/charms/trusty/percona-cluster/trunk

Proposed by Jorge Niedbalski
Status: Merged
Approved by: Edward Hope-Morley
Approved revision: 39
Merge reported by: Edward Hope-Morley
Merged at revision: not available
Proposed branch: lp:~niedbalski/charms/trusty/percona-cluster/fix-default-password-grant
Merge into: lp:~openstack-charmers-archive/charms/trusty/percona-cluster/trunk
Diff against target: 39 lines (+13/-7)
1 file modified
hooks/percona_hooks.py (+13/-7)
To merge this branch: bzr merge lp:~niedbalski/charms/trusty/percona-cluster/fix-default-password-grant
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Edward Hope-Morley Pending
Review via email: mp+236408@code.launchpad.net

This proposal supersedes a proposal from 2014-09-29.

Description of the change

If no sst-password is specified then , a randomly generated one is created using pwgen. This
password is correctly set on the configuration file ( my.cnf ) but the replication permissions are set incorrectly.

The charm is performing:

GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'sstuser'@'localhost' IDENTIFIED BY 'None'

Replication:

$ juju deploy percona-cluster
$ juju add-unit percona-cluster
$ juju ssh 1 -e service mysql restart

This will fail due to no permissions for perform the reload on the cluster.

The linked branch , fixes this issue.

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

$ make lint
hooks/percona_hooks.py:91:41: E128 continuation line under-indented for visual indent
make: *** [lint] Error 1

Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

Fixed.

niedbalski@theos-mobile:~/src/juju/charms/trusty/percona-cluster$ make lint
W: No icon.svg file.

Revision history for this message
Edward Hope-Morley (hopem) wrote : Posted in a previous version of this proposal

LGTM, good catch

review: Approve

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 2014-08-18 15:31:29 +0000
3+++ hooks/percona_hooks.py 2014-09-29 18:55:25 +0000
4@@ -74,22 +74,28 @@
5 elif config('source') is not None:
6 add_source(config('source'))
7 configure_mysql_root_password(config('root-password'))
8- render_config() # Render base configuation (no cluster)
9+ mysql_password = get_mysql_password(username='sstuser',
10+ password=config('sst-password'))
11+ render_config(mysql_password=mysql_password)
12 apt_update(fatal=True)
13 apt_install(PACKAGES, fatal=True)
14- configure_sstuser(config('sst-password'))
15-
16-
17-def render_config(clustered=False, hosts=[]):
18+ configure_sstuser(mysql_password)
19+
20+
21+def render_config(clustered=False, hosts=[], mysql_password=None):
22 if not os.path.exists(os.path.dirname(MY_CNF)):
23 os.makedirs(os.path.dirname(MY_CNF))
24+
25+ if not mysql_password:
26+ mysql_password = get_mysql_password(username='sstuser',
27+ password=config('sst-password'))
28+
29 context = {
30 'cluster_name': 'juju_cluster',
31 'private_address': get_host_ip(),
32 'clustered': clustered,
33 'cluster_hosts': ",".join(hosts),
34- 'sst_password': get_mysql_password(username='sstuser',
35- password=config('sst-password'))
36+ 'sst_password': mysql_password,
37 }
38 context.update(parse_config())
39 write_file(path=MY_CNF,

Subscribers

People subscribed via source and target branches

to status/vote changes: