Merge "Fixes re-auth flow with expired tokens."

This commit is contained in:
Jenkins
2013-06-19 18:31:15 +00:00
committed by Gerrit Code Review

View File

@@ -1034,6 +1034,7 @@ class Connection(object):
def _retry(self, reset_func, func, *args, **kwargs): def _retry(self, reset_func, func, *args, **kwargs):
self.attempts = 0 self.attempts = 0
retried_auth = False
backoff = self.starting_backoff backoff = self.starting_backoff
while self.attempts <= self.retries: while self.attempts <= self.retries:
self.attempts += 1 self.attempts += 1
@@ -1055,10 +1056,11 @@ class Connection(object):
raise raise
if err.http_status == 401: if err.http_status == 401:
self.url = self.token = None self.url = self.token = None
if self.attempts > 1 or not all((self.authurl, if retried_auth or not all((self.authurl,
self.user, self.user,
self.key)): self.key)):
raise raise
retried_auth = True
elif err.http_status == 408: elif err.http_status == 408:
self.http_conn = None self.http_conn = None
elif 500 <= err.http_status <= 599: elif 500 <= err.http_status <= 599: