Retry also on certain connection errors. (#680)
parent
29cd0b3bde
commit
e4ba0861e5
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- "acme_* modules - also retry requests in case of socket errors, bad status lines, and unknown connection errors; improve error messages in these cases (https://github.com/ansible-collections/community.crypto/issues/680)."
|
|
@ -55,7 +55,8 @@ else:
|
|||
IPADDRESS_IMPORT_ERROR = None
|
||||
|
||||
|
||||
RETRY_STATUS_CODES = (408, 429, 503)
|
||||
# -1 usually means connection problems
|
||||
RETRY_STATUS_CODES = (-1, 408, 429, 503)
|
||||
|
||||
|
||||
def _decode_retry(module, response, info, retry_count):
|
||||
|
|
|
@ -100,6 +100,8 @@ class ACMEProtocolException(ModuleFailException):
|
|||
http_code=format_http_status(code), problem_code=content_json['status'])
|
||||
else:
|
||||
code = 'status {problem_code}'.format(problem_code=format_http_status(code))
|
||||
if code == -1 and info.get('msg'):
|
||||
code += ' ({msg})'.format(msg=info['msg'])
|
||||
subproblems = content_json.pop('subproblems', None)
|
||||
add_msg = ' {problem}.'.format(problem=format_error_problem(content_json))
|
||||
extras['problem'] = content_json
|
||||
|
@ -114,6 +116,8 @@ class ACMEProtocolException(ModuleFailException):
|
|||
)
|
||||
else:
|
||||
code = 'HTTP status {code}'.format(code=format_http_status(code))
|
||||
if code == -1 and info.get('msg'):
|
||||
code += ' ({msg})'.format(msg=info['msg'])
|
||||
if content_json is not None:
|
||||
add_msg = ' The JSON error result: {content}'.format(content=content_json)
|
||||
elif content is not None:
|
||||
|
|
Loading…
Reference in New Issue