Refine default 401 handling (#64619)
This commit is contained in:
parent
0d851dda59
commit
abf3319666
1 changed files with 9 additions and 5 deletions
|
@ -68,11 +68,15 @@ class HttpApiBase(AnsiblePlugin):
|
|||
server without making another request. In many cases, this can just
|
||||
be the original exception.
|
||||
"""
|
||||
if exc.code == 401 and self.connection._auth:
|
||||
if exc.code == 401:
|
||||
if self.connection._auth:
|
||||
# Stored auth appears to be invalid, clear and retry
|
||||
self.connection._auth = None
|
||||
self.login(self.connection.get_option('remote_user'), self.connection.get_option('password'))
|
||||
return True
|
||||
else:
|
||||
# Unauthorized and there's no token. Return an error
|
||||
return False
|
||||
|
||||
return exc
|
||||
|
||||
|
|
Loading…
Reference in a new issue