acme_challenge_cert_helper: fail better to avoid crashes in Ansible (#282)

* Prevent acme_challenge_cert_helper triggering a bug in Ansible.

* Add changelog fragment.
pull/267/head
Felix Fontein 2021-09-17 19:35:43 +02:00 committed by GitHub
parent 598cdf0a21
commit 63f4598737
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,2 @@
bugfixes:
- "acme_challenge_cert_helper - only return exception when cryptography is not installed, not when a too old version of it is installed. This prevents Ansible's callback to crash (https://github.com/ansible-collections/community.crypto/pull/281)."

View File

@ -202,7 +202,10 @@ def main():
),
)
if not HAS_CRYPTOGRAPHY:
# Some callbacks die when exception is provided with value None
if CRYPTOGRAPHY_IMP_ERR:
module.fail_json(msg=missing_required_lib('cryptography >= 1.3'), exception=CRYPTOGRAPHY_IMP_ERR)
module.fail_json(msg=missing_required_lib('cryptography >= 1.3'))
try:
# Get parameters