Merge lp:~gnuoy/charms/trusty/percona-cluster/bug-1389670take2 into lp:~openstack-charmers-archive/charms/trusty/percona-cluster/trunk

Proposed by Liam Young
Status: Work in progress
Proposed branch: lp:~gnuoy/charms/trusty/percona-cluster/bug-1389670take2
Merge into: lp:~openstack-charmers-archive/charms/trusty/percona-cluster/trunk
Diff against target: 51 lines (+7/-6)
1 file modified
hooks/percona_hooks.py (+7/-6)
To merge this branch: bzr merge lp:~gnuoy/charms/trusty/percona-cluster/bug-1389670take2
Reviewer Review Type Date Requested Status
Edward Hope-Morley Needs Fixing
charmers Pending
Review via email: mp+247509@code.launchpad.net

Description of the change

Don't store the allowed_units info in the peerdb as the information is available directly from the db

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

Unmerged revisions

44. By Liam Young

Fix local variable 'allowed_units' referenced before assignment

43. By Liam Young

Dont store allowed units in peerdb

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-12-17 18:59:55 +0000
3+++ hooks/percona_hooks.py 2015-01-24 12:53:28 +0000
4@@ -23,7 +23,6 @@
5 from charmhelpers.core.host import (
6 service_restart,
7 file_hash,
8- write_file,
9 lsb_release,
10 )
11 from charmhelpers.core.templating import render
12@@ -287,8 +286,8 @@
13 db_host = get_db_host(hostname)
14 peer_store_and_set(relation_id=relation_id,
15 db_host=db_host,
16- password=password,
17- allowed_units=allowed_units)
18+ password=password)
19+ relation_set(relation_id=relation_id, allowed_units=allowed_units)
20 else:
21 # Process multiple database setup requests.
22 # from incoming relation data:
23@@ -317,6 +316,7 @@
24 databases[db][x] = v
25
26 return_data = {}
27+ allowed_units = []
28 for db in databases:
29 if singleset.issubset(databases[db]):
30 database = databases[db]['database']
31@@ -334,9 +334,9 @@
32 password = configure_db(hostname, database, username)
33
34 return_data['_'.join([db, 'password'])] = password
35- return_data['_'.join([db, 'allowed_units'])] = \
36- " ".join(unit_sorted(get_allowed_units(database,
37- username)))
38+ allowed_units = unit_sorted(get_allowed_units(database,
39+ username))
40+ allowed_units = ' '.join(allowed_units)
41 db_host = get_db_host(hostname)
42
43 if len(return_data) > 0:
44@@ -344,6 +344,7 @@
45 **return_data)
46 peer_store_and_set(relation_id=relation_id,
47 db_host=db_host)
48+ relation_set(relation_id=relation_id, allowed_units=allowed_units)
49
50 peer_store_and_set(relation_id=relation_id,
51 relation_settings={'access-network': access_network})

Subscribers

People subscribed via source and target branches

to status/vote changes: