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
|
server without making another request. In many cases, this can just
|
||||||
be the original exception.
|
be the original exception.
|
||||||
"""
|
"""
|
||||||
if exc.code == 401 and self.connection._auth:
|
if exc.code == 401:
|
||||||
# Stored auth appears to be invalid, clear and retry
|
if self.connection._auth:
|
||||||
self.connection._auth = None
|
# Stored auth appears to be invalid, clear and retry
|
||||||
self.login(self.connection.get_option('remote_user'), self.connection.get_option('password'))
|
self.connection._auth = None
|
||||||
return True
|
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
|
return exc
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue