Merge "Make os-cache retry on an invalid token"
This commit is contained in:
commit
8f63621c49
|
@ -213,9 +213,11 @@ class HTTPClient(object):
|
|||
return resp, body
|
||||
except exceptions.Unauthorized as e:
|
||||
try:
|
||||
# frist discard auth token, to avoid the possibly expired
|
||||
# first discard auth token, to avoid the possibly expired
|
||||
# token being re-used in the re-authentication attempt
|
||||
self.unauthenticate()
|
||||
# overwrite bad token
|
||||
self.keyring_saved = False
|
||||
self.authenticate()
|
||||
kwargs['headers']['X-Auth-Token'] = self.auth_token
|
||||
resp, body = self._time_request(self.management_url + url,
|
||||
|
|
|
@ -629,15 +629,9 @@ class OpenStackComputeShell(object):
|
|||
self.cs.client.tenant_id = tenant_id
|
||||
self.cs.client.auth_token = auth_token
|
||||
self.cs.client.management_url = management_url
|
||||
# Try to auth with the given info, if it fails
|
||||
# go into password mode...
|
||||
try:
|
||||
self.cs.authenticate()
|
||||
use_pw = False
|
||||
except (exc.Unauthorized, exc.AuthorizationFailure):
|
||||
# Likely it expired or just didn't work...
|
||||
self.cs.client.auth_token = None
|
||||
self.cs.client.management_url = None
|
||||
# authenticate just sets up some values in this case, no REST
|
||||
# calls
|
||||
self.cs.authenticate()
|
||||
if use_pw:
|
||||
# Auth using token must have failed or not happened
|
||||
# at all, so now switch to password mode and save
|
||||
|
|
Loading…
Reference in New Issue