Merge lp:~kubernetes/charms/trusty/etcd/trunk into lp:charms/trusty/etcd

Proposed by Charles Butler
Status: Merged
Merged at revision: 17
Proposed branch: lp:~kubernetes/charms/trusty/etcd/trunk
Merge into: lp:charms/trusty/etcd
Diff against target: 73 lines (+18/-5)
4 files modified
README.md (+7/-1)
hooks/hooks.py (+8/-1)
templates/etcd.conf.jinja2 (+1/-1)
tests/10-deploy (+2/-2)
To merge this branch: bzr merge lp:~kubernetes/charms/trusty/etcd/trunk
Reviewer Review Type Date Requested Status
Matt Bruzek (community) Approve
Review via email: mp+268373@code.launchpad.net

Description of the change

Updates init template to include a local host binding

To post a comment you must log in.
Revision history for this message
Charles Butler (lazypower) wrote :

This appears to have pulled in a prior merge that hasn't quite landed,

Not sure what happened as that MP is not listed as active against the charmers branch of the charm. Please address this MP as required, noting that the included fix was to correct an issue where leader election is not available in older releases of Juju, and this adds behavior to correctly notify the user that leader election is not available.

19. By Matt Bruzek

The run method is on the unit object not sentry.

Revision history for this message
Matt Bruzek (mbruzek) wrote :

+1 LGTM Tests pass now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.md'
2--- README.md 2015-07-17 14:48:11 +0000
3+++ README.md 2015-09-22 16:27:05 +0000
4@@ -51,11 +51,17 @@
5 juju action fetch <uuid>
6
7
8+## Usage Caveats
9+
10+This charm requires Leader Election, which is a feature of Juju >= 1.23.2. The
11+charm will panic and refuse to continue if the leader_election binary is not
12+found. Please take care when deploying this charm on older versions of Juju.
13+
14 ## Credits
15
16 The etcd charm was originally written by Kapil Thangavelu ([@kapilt](https://github.com/kapilt)).
17
18-#### Mantainers:
19+#### Maintainers:
20
21 The kubernetes team maintains this charm:
22 - Whit Morriss &lt;whit.morriss@canonical.com&gt;
23
24=== modified file 'hooks/hooks.py'
25--- hooks/hooks.py 2015-07-24 19:30:09 +0000
26+++ hooks/hooks.py 2015-09-22 16:27:05 +0000
27@@ -16,11 +16,18 @@
28 hook_data = unitdata.HookData()
29 db = unitdata.kv()
30
31-leader_status = check_output(['is-leader']).rstrip() != "False"
32 private_address = hookenv.unit_get('private-address')
33 public_address = hookenv.unit_get('private-address')
34 unit_name = environ['JUJU_UNIT_NAME'].replace('/', '')
35
36+try:
37+ leader_status = hookenv.is_leader()
38+except NotImplementedError:
39+ hookenv.log('This charm requires Leader Election. Juju >= 1.23.2.'
40+ ' Leader election binary not found, Panic and exit!',
41+ 'CRITICAL')
42+ sys.exit(1)
43+
44
45 @hooks.hook('config-changed')
46 def config_changed():
47
48=== modified file 'templates/etcd.conf.jinja2'
49--- templates/etcd.conf.jinja2 2015-07-13 16:56:39 +0000
50+++ templates/etcd.conf.jinja2 2015-09-22 16:27:05 +0000
51@@ -11,7 +11,7 @@
52 exec /opt/etcd/etcd \
53 --initial-advertise-peer-urls http://{{private_address}}:7001 \
54 --listen-peer-urls http://{{private_address}}:7001 \
55- --listen-client-urls http://{{private_address}}:4001 \
56+ --listen-client-urls http://127.0.0.1:4001,http://{{private_address}}:4001 \
57 --advertise-client-urls http://{{private_address}}:4001 \
58 --initial-cluster-token {{token}} \
59 --initial-cluster-state {{cluster_state}} \
60
61=== modified file 'tests/10-deploy'
62--- tests/10-deploy 2015-07-13 16:56:39 +0000
63+++ tests/10-deploy 2015-09-22 16:27:05 +0000
64@@ -26,8 +26,8 @@
65 self.deployment.add_unit('etcd')
66 self.deployment.sentry.wait()
67
68- status1 = self.deployment.sentry['etcd/0'].run('service etcd status')
69- status2 = self.deployment.sentry['etcd/1'].run('service etcd status')
70+ status1 = self.deployment.sentry.unit['etcd/0'].run('service etcd status')
71+ status2 = self.deployment.sentry.unit['etcd/1'].run('service etcd status')
72 self.assertTrue("running" in status1[0])
73 self.assertTrue("running" in status2[0])
74

Subscribers

People subscribed via source and target branches

to all changes: