Get rid of backend parameter whenever possible (#883)

* Get rid of backend parameter whenever possible.

* Always auto-detect if backend choices are 'cryptography' and 'auto', resp. always check cryptography version.

* Improve error message.

* Update documentation.
This commit is contained in:
Felix Fontein
2025-05-03 10:46:53 +02:00
committed by GitHub
parent fbcb89f092
commit 645b7bf9ed
50 changed files with 502 additions and 1093 deletions

View File

@@ -305,9 +305,7 @@ def openssl_csr_info_filter(data, name_encoding="ignore"):
module = FilterModuleMock({"name_encoding": name_encoding})
try:
return get_csr_info(
module, "cryptography", content=to_bytes(data), validate_signature=True
)
return get_csr_info(module, content=to_bytes(data), validate_signature=True)
except OpenSSLObjectError as exc:
raise AnsibleFilterError(str(exc))

View File

@@ -181,7 +181,6 @@ def openssl_privatekey_info_filter(
try:
result = get_privatekey_info(
module,
"cryptography",
content=to_bytes(data),
passphrase=passphrase,
return_private_key_data=return_private_key_data,

View File

@@ -146,7 +146,7 @@ def openssl_publickey_info_filter(data):
module = FilterModuleMock({})
try:
return get_publickey_info(module, "cryptography", content=to_bytes(data))
return get_publickey_info(module, content=to_bytes(data))
except PublicKeyParseError as exc:
raise AnsibleFilterError(exc.error_message)
except OpenSSLObjectError as exc:

View File

@@ -339,7 +339,7 @@ def x509_certificate_info_filter(data, name_encoding="ignore"):
module = FilterModuleMock({"name_encoding": name_encoding})
try:
return get_certificate_info(module, "cryptography", content=to_bytes(data))
return get_certificate_info(module, content=to_bytes(data))
except OpenSSLObjectError as exc:
raise AnsibleFilterError(str(exc))