mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-06 13:22:58 +00:00
Code refactoring (#889)
* Add __all__ to all module and plugin utils. * Convert quite a few positional args to keyword args. * Avoid Python 3.8+ syntax.
This commit is contained in:
@@ -59,7 +59,7 @@ def gpg_fingerprint(input: str | bytes) -> str:
|
||||
)
|
||||
try:
|
||||
gpg = PluginGPGRunner()
|
||||
return get_fingerprint_from_bytes(gpg, to_bytes(input))
|
||||
return get_fingerprint_from_bytes(gpg_runner=gpg, content=to_bytes(input))
|
||||
except GPGError as exc:
|
||||
raise AnsibleFilterError(str(exc))
|
||||
|
||||
|
||||
@@ -309,7 +309,9 @@ def openssl_csr_info_filter(
|
||||
|
||||
module = FilterModuleMock({"name_encoding": name_encoding})
|
||||
try:
|
||||
return get_csr_info(module, content=to_bytes(data), validate_signature=True)
|
||||
return get_csr_info(
|
||||
module=module, content=to_bytes(data), validate_signature=True
|
||||
)
|
||||
except OpenSSLObjectError as exc:
|
||||
raise AnsibleFilterError(str(exc))
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ def openssl_privatekey_info_filter(
|
||||
module = FilterModuleMock({})
|
||||
try:
|
||||
result = get_privatekey_info(
|
||||
module,
|
||||
module=module,
|
||||
content=to_bytes(data),
|
||||
passphrase=to_text(passphrase) if passphrase is not None else None,
|
||||
return_private_key_data=return_private_key_data,
|
||||
|
||||
@@ -148,7 +148,7 @@ def openssl_publickey_info_filter(data: str | bytes) -> dict[str, t.Any]:
|
||||
|
||||
module = FilterModuleMock({})
|
||||
try:
|
||||
return get_publickey_info(module, content=to_bytes(data))
|
||||
return get_publickey_info(module=module, content=to_bytes(data))
|
||||
except PublicKeyParseError as exc:
|
||||
raise AnsibleFilterError(exc.error_message)
|
||||
except OpenSSLObjectError as exc:
|
||||
|
||||
@@ -343,7 +343,7 @@ def x509_certificate_info_filter(
|
||||
|
||||
module = FilterModuleMock({"name_encoding": name_encoding})
|
||||
try:
|
||||
return get_certificate_info(module, content=to_bytes(data))
|
||||
return get_certificate_info(module=module, content=to_bytes(data))
|
||||
except OpenSSLObjectError as exc:
|
||||
raise AnsibleFilterError(str(exc))
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ def x509_crl_info_filter(
|
||||
module = FilterModuleMock({"name_encoding": name_encoding})
|
||||
try:
|
||||
return get_crl_info(
|
||||
module,
|
||||
module=module,
|
||||
content=data_bytes,
|
||||
list_revoked_certificates=list_revoked_certificates,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user