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:
parent
2be5ebddcc
commit
b86b1aa35f
@ -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
3
templates/etcd
Normal file
@ -0,0 +1,3 @@
|
||||
ETCD_PROXY=on
|
||||
ETCD_INITIAL_CLUSTER={{ cluster }}
|
||||
ETCD_DATA_DIR=/var/lib/etcd
|
@ -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
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user