summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartlomiej Biernacki <bartlomiej.biernacki@ntti3.com>2015-11-30 10:29:28 +0100
committerBartlomiej Biernacki <bartlomiej.biernacki@ntti3.com>2015-11-30 10:29:28 +0100
commit31f57fa0143777240371c0a5f85a920ca6347807 (patch)
treec08a2b26e6b59a5b20e0017aa3d16b9667cecfdf
parentebd7036210bb8cd94a66d2db3ddac77e808fab59 (diff)
Make response False on exception
When exception will be raised on _ = response.data we will handle exception, but as response is not None the while loop won't be repeated. This may lead to an error on _handle_server_response as we may get a response with status == 200 and empty data.
-rw-r--r--src/etcd/client.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/etcd/client.py b/src/etcd/client.py
index a5c656d..de898b6 100644
--- a/src/etcd/client.py
+++ b/src/etcd/client.py
@@ -821,6 +821,11 @@ class Client(object):
# machines left to try, breaking out of the loop.
self._base_uri = self._next_server(cause=e)
some_request_failed = True
+
+ # if exception is raised on _ = response.data
+ # the condition for while loop will be False
+ # but we should retry
+ response = False
else:
_log.debug("Reconnection disabled, giving up.")
raise etcd.EtcdConnectionFailed(