Support for etcd on Xenial

Generate etcd config in form suitable for systemd init as well as for
upstart.

Change-Id: I78091d630e95d94e9b6effb077cce1fe63687474
This commit is contained in:
Neil Jerram 2016-04-05 12:12:24 +01:00 committed by Neil Jerram
parent 2be5ebddcc
commit b86b1aa35f
4 changed files with 12 additions and 6 deletions

View File

@ -652,6 +652,8 @@ def etcd_proxy_force_restart(relation_id=None):
# treat etcd like the special snowflake it insists on being.
CONFIGS.register('/etc/init/etcd.conf', [EtcdContext()])
CONFIGS.write('/etc/init/etcd.conf')
CONFIGS.register('/etc/default/etcd', [EtcdContext()])
CONFIGS.write('/etc/default/etcd')
if 'etcd-proxy' in CONFIGS.complete_contexts():
force_etcd_restart()

3
templates/etcd Normal file
View File

@ -0,0 +1,3 @@
ETCD_PROXY=on
ETCD_INITIAL_CLUSTER={{ cluster }}
ETCD_DATA_DIR=/var/lib/etcd

View File

@ -9,8 +9,8 @@ respawn
setuid etcd
env ETCD_DATA_DIR=/var/lib/etcd
export ETCD_DATA_DIR
exec /usr/bin/etcd -proxy on \
-initial-cluster {{ cluster }}
script
set -a
. /etc/default/etcd
exec /usr/bin/etcd
end script

View File

@ -945,4 +945,5 @@ class NeutronAPIHooksTests(CharmTestCase):
def test_etcd_peer_joined(self):
self._call_hook('etcd-proxy-relation-joined')
self.assertTrue(self.CONFIGS.register.called)
self.CONFIGS.write.assert_called_with('/etc/init/etcd.conf')
self.CONFIGS.write.assert_any_call('/etc/init/etcd.conf')
self.CONFIGS.write.assert_any_call('/etc/default/etcd')