mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-07 05:43:06 +00:00
Retry also on certain connection errors. (#680)
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user