mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-06 21:33:00 +00:00
acme_certificate and acme_certificate_create_order: add order_creation_error_strategy and order_creation_max_retries options (#842)
* Provide error information. * Add helper function for order creation retrying. * Improve existing documentation. * Document 'replaces' return value. * Add order_creation_error_strategy and order_creation_max_retries options. * Add changelog fragment. * Fix authz deactivation for finalizing step. * Fix profile handling on order creation. * Improve existing tests. * Add ARI and profile tests. * Warn when 'replaces' is removed when retrying to create an order.
This commit is contained in:
@@ -84,6 +84,8 @@ class ACMEProtocolException(ModuleFailException):
|
||||
pass
|
||||
|
||||
extras = extras or dict()
|
||||
error_code = None
|
||||
error_type = None
|
||||
|
||||
if msg is None:
|
||||
msg = 'ACME request failed'
|
||||
@@ -94,7 +96,9 @@ class ACMEProtocolException(ModuleFailException):
|
||||
code = info['status']
|
||||
extras['http_url'] = url
|
||||
extras['http_status'] = code
|
||||
error_code = code
|
||||
if code is not None and code >= 400 and content_json is not None and 'type' in content_json:
|
||||
error_type = content_json['type']
|
||||
if 'status' in content_json and content_json['status'] != code:
|
||||
code_msg = 'status {problem_code} (HTTP status: {http_code})'.format(
|
||||
http_code=format_http_status(code), problem_code=content_json['status'])
|
||||
@@ -134,6 +138,8 @@ class ACMEProtocolException(ModuleFailException):
|
||||
)
|
||||
self.problem = {}
|
||||
self.subproblems = []
|
||||
self.error_code = error_code
|
||||
self.error_type = error_type
|
||||
for k, v in extras.items():
|
||||
setattr(self, k, v)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user