diff --git a/hooks/neutron_api_hooks.py b/hooks/neutron_api_hooks.py index 74a2a58a..f01965db 100755 --- a/hooks/neutron_api_hooks.py +++ b/hooks/neutron_api_hooks.py @@ -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() diff --git a/templates/etcd b/templates/etcd new file mode 100644 index 00000000..146737d7 --- /dev/null +++ b/templates/etcd @@ -0,0 +1,3 @@ +ETCD_PROXY=on +ETCD_INITIAL_CLUSTER={{ cluster }} +ETCD_DATA_DIR=/var/lib/etcd diff --git a/templates/icehouse/etcd.conf b/templates/icehouse/etcd.conf index 01f42561..60cf7491 100644 --- a/templates/icehouse/etcd.conf +++ b/templates/icehouse/etcd.conf @@ -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 diff --git a/unit_tests/test_neutron_api_hooks.py b/unit_tests/test_neutron_api_hooks.py index 569e9a83..d7944b57 100644 --- a/unit_tests/test_neutron_api_hooks.py +++ b/unit_tests/test_neutron_api_hooks.py @@ -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')