mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-18 14:21:06 -07:00
Change handle_httperror in httpapi plugins (#53391)
* Change return of handle_httperror * Fix restconf for handle_httperror changes
This commit is contained in:
parent
662dd2c1de
commit
3fe2013b3f
4 changed files with 27 additions and 30 deletions
|
@ -61,19 +61,20 @@ class HttpApiBase(AnsiblePlugin):
|
|||
:returns:
|
||||
* True if the code has been handled in a way that the request
|
||||
may be resent without changes.
|
||||
* False if this code indicates a fatal or unknown error which
|
||||
cannot be handled by the plugin. This will result in an
|
||||
AnsibleConnectionFailure being raised.
|
||||
* Any other response passes the HTTPError along to the caller to
|
||||
deal with as appropriate.
|
||||
"""
|
||||
* False if the error cannot be handled or recovered from by the
|
||||
plugin. This will result in the HTTPError being returned to the
|
||||
caller to deal with as appropriate.
|
||||
* Any other value returned is taken as a valid response from the
|
||||
server without making another request. In many cases, this can just
|
||||
be the original exception.
|
||||
"""
|
||||
if exc.code == 401 and 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
|
||||
|
||||
return False
|
||||
return exc
|
||||
|
||||
@abstractmethod
|
||||
def send_request(self, data, **message_kwargs):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue