summaryrefslogtreecommitdiff
path: root/swiftclient/client.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-08-26 17:37:41 +0000
committerGerrit Code Review <review@openstack.org>2016-08-26 17:37:41 +0000
commit20e0c515bf23841015102fb72d61ab18c826c036 (patch)
tree4f9b22622bfb9ba255a504faa905daf7605c8b31 /swiftclient/client.py
parent19cd127294cca46979671c51e68ba6601028628d (diff)
parenta62b7ee06c1a300c73d9a01b2c9bc05028f1fabd (diff)
downloadpython-swiftclient-20e0c515bf23841015102fb72d61ab18c826c036.tar.gz
Merge "client: renew token on 401 even if retries is 0"
Diffstat (limited to 'swiftclient/client.py')
-rw-r--r--swiftclient/client.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/swiftclient/client.py b/swiftclient/client.py
index 602489d..988c7d9 100644
--- a/swiftclient/client.py
+++ b/swiftclient/client.py
@@ -1619,7 +1619,7 @@ class Connection(object):
backoff = self.starting_backoff
caller_response_dict = kwargs.pop('response_dict', None)
self.attempts = kwargs.pop('attempts', 0)
- while self.attempts <= self.retries:
+ while self.attempts <= self.retries or retried_auth:
self.attempts += 1
try:
if not self.url or not self.token:
@@ -1648,9 +1648,6 @@ class Connection(object):
self.http_conn = None
except ClientException as err:
self._add_response_dict(caller_response_dict, kwargs)
- if self.attempts > self.retries or err.http_status is None:
- logger.exception(err)
- raise
if err.http_status == 401:
self.url = self.token = self.service_token = None
if retried_auth or not all((self.authurl,
@@ -1659,6 +1656,9 @@ class Connection(object):
logger.exception(err)
raise
retried_auth = True
+ elif self.attempts > self.retries or err.http_status is None:
+ logger.exception(err)
+ raise
elif err.http_status == 408:
self.http_conn = None
elif 500 <= err.http_status <= 599: