Allow type to be missing. (#652)
parent
5d2bfddc15
commit
526b3c4393
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- "acme_* modules - correctly handle error documents without ``type`` (https://github.com/ansible-collections/community.crypto/issues/651, https://github.com/ansible-collections/community.crypto/pull/652)."
|
|
@ -21,13 +21,14 @@ def format_http_status(status_code):
|
||||||
|
|
||||||
|
|
||||||
def format_error_problem(problem, subproblem_prefix=''):
|
def format_error_problem(problem, subproblem_prefix=''):
|
||||||
|
error_type = problem.get('type', 'about:blank') # https://www.rfc-editor.org/rfc/rfc7807#section-3.1
|
||||||
if 'title' in problem:
|
if 'title' in problem:
|
||||||
msg = 'Error "{title}" ({type})'.format(
|
msg = 'Error "{title}" ({type})'.format(
|
||||||
type=problem['type'],
|
type=error_type,
|
||||||
title=problem['title'],
|
title=problem['title'],
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
msg = 'Error {type}'.format(type=problem['type'])
|
msg = 'Error {type}'.format(type=error_type)
|
||||||
if 'detail' in problem:
|
if 'detail' in problem:
|
||||||
msg += ': "{detail}"'.format(detail=problem['detail'])
|
msg += ': "{detail}"'.format(detail=problem['detail'])
|
||||||
subproblems = problem.get('subproblems')
|
subproblems = problem.get('subproblems')
|
||||||
|
|
Loading…
Reference in New Issue