Allow type to be missing. (#652)

pull/655/head
Felix Fontein 2023-08-21 20:49:55 +02:00 committed by GitHub
parent 5d2bfddc15
commit 526b3c4393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -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)."

View File

@ -21,13 +21,14 @@ def format_http_status(status_code):
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:
msg = 'Error "{title}" ({type})'.format(
type=problem['type'],
type=error_type,
title=problem['title'],
)
else:
msg = 'Error {type}'.format(type=problem['type'])
msg = 'Error {type}'.format(type=error_type)
if 'detail' in problem:
msg += ': "{detail}"'.format(detail=problem['detail'])
subproblems = problem.get('subproblems')