diff --git a/fuel_ccp_entrypoint/start_script.py b/fuel_ccp_entrypoint/start_script.py index 782805b..9d9da85 100644 --- a/fuel_ccp_entrypoint/start_script.py +++ b/fuel_ccp_entrypoint/start_script.py @@ -41,8 +41,8 @@ class ProcessException(Exception): def retry(f): @functools.wraps(f) def wrap(*args, **kwargs): - attempts = VARIABLES.get('etcd_connection_attempts', 10) - delay = VARIABLES.get('etcd_connection_delay', 5) + attempts = VARIABLES['etcd']['connection_attempts'] + delay = VARIABLES['etcd']['connection_delay'] while attempts > 1: try: return f(*args, **kwargs) @@ -250,10 +250,10 @@ def get_etcd_client(): if VARIABLES["role_name"] == "etcd": etcd_machines.append( (VARIABLES["network_topology"]["private"]["address"], - VARIABLES["etcd_client_port"])) + VARIABLES["etcd"]["client_port"])) else: etcd_machines.append( - (address('etcd'), VARIABLES["etcd_client_port"]) + (address('etcd'), VARIABLES["etcd"]["client_port"]) ) etcd_machines_str = " ".join(["%s:%d" % (h, p) for h, p in etcd_machines]) diff --git a/fuel_ccp_entrypoint/tests/test_fuel_ccp_entrypoint.py b/fuel_ccp_entrypoint/tests/test_fuel_ccp_entrypoint.py index 89ecb1d..81993da 100644 --- a/fuel_ccp_entrypoint/tests/test_fuel_ccp_entrypoint.py +++ b/fuel_ccp_entrypoint/tests/test_fuel_ccp_entrypoint.py @@ -104,10 +104,10 @@ class TestGetVariables(base.TestCase): class TestRetry(base.TestCase): def setUp(self): super(TestRetry, self).setUp() - start_script.VARIABLES = { - 'etcd_connection_attempts': 3, - 'etcd_connection_delay': 0 - } + start_script.VARIABLES = {'etcd': { + 'connection_attempts': 3, + 'connection_delay': 0 + }} @start_script.retry def func_test(self): @@ -132,7 +132,11 @@ class TestGetETCDClient(base.TestCase): def test_get_etcd_local_client(self): start_script.VARIABLES = { "role_name": "etcd", - "etcd_client_port": 10042, + "etcd": { + "client_port": 10042, + "connection_attempts": 3, + "connection_delay": 0, + }, "network_topology": { "private": { "address": "192.0.2.1" @@ -153,7 +157,11 @@ class TestGetETCDClient(base.TestCase): start_script.VARIABLES = { "role_name": "banana", "namespace": "ccp", - "etcd_client_port": 1234 + "etcd": { + "client_port": 1234, + "connection_attempts": 3, + "connection_delay": 0, + }, } with mock.patch("etcd.Client") as m_etcd: expected_value = object()