mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-07 22:03:01 +00:00
Work on issues found by pylint (#896)
* Look at possibly-used-before-assignment. * Use latest beta releases of ansible-core 2.19 for mypy and pylint. * Look at unsupported-*. * Look at unknown-option-value. * Look at redefined-builtin. * Look at superfluous-parens. * Look at unspecified-encoding. * Adjust to new cryptography version and to ansible-core 2.17's pylint. * Look at super-with-arguments. * Look at no-else-*. * Look at try-except-raise. * Look at inconsistent-return-statements. * Look at redefined-outer-name. * Look at redefined-argument-from-local. * Look at attribute-defined-outside-init. * Look at unused-variable. * Look at protected-access. * Look at raise-missing-from. * Look at arguments-differ. * Look at useless-suppression and use-symbolic-message-instead. * Look at consider-using-dict-items. * Look at consider-using-in. * Look at consider-using-set-comprehension. * Look at consider-using-with. * Look at use-dict-literal.
This commit is contained in:
@@ -134,7 +134,7 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.support i
|
||||
class SignatureBase(OpenSSLObject):
|
||||
|
||||
def __init__(self, module: AnsibleModule) -> None:
|
||||
super(SignatureBase, self).__init__(
|
||||
super().__init__(
|
||||
path=module.params["path"],
|
||||
state="present",
|
||||
force=False,
|
||||
@@ -163,7 +163,7 @@ class SignatureBase(OpenSSLObject):
|
||||
class SignatureCryptography(SignatureBase):
|
||||
|
||||
def __init__(self, module: AnsibleModule) -> None:
|
||||
super(SignatureCryptography, self).__init__(module)
|
||||
super().__init__(module)
|
||||
|
||||
def run(self) -> dict[str, t.Any]:
|
||||
_padding = cryptography.hazmat.primitives.asymmetric.padding.PKCS1v15()
|
||||
@@ -224,20 +224,22 @@ class SignatureCryptography(SignatureBase):
|
||||
return result
|
||||
|
||||
except Exception as e:
|
||||
raise OpenSSLObjectError(e)
|
||||
raise OpenSSLObjectError(e) from e
|
||||
|
||||
|
||||
def main() -> t.NoReturn:
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
privatekey_path=dict(type="path"),
|
||||
privatekey_content=dict(type="str", no_log=True),
|
||||
privatekey_passphrase=dict(type="str", no_log=True),
|
||||
path=dict(type="path", required=True),
|
||||
select_crypto_backend=dict(
|
||||
type="str", choices=["auto", "cryptography"], default="auto"
|
||||
),
|
||||
),
|
||||
argument_spec={
|
||||
"privatekey_path": {"type": "path"},
|
||||
"privatekey_content": {"type": "str", "no_log": True},
|
||||
"privatekey_passphrase": {"type": "str", "no_log": True},
|
||||
"path": {"type": "path", "required": True},
|
||||
"select_crypto_backend": {
|
||||
"type": "str",
|
||||
"choices": ["auto", "cryptography"],
|
||||
"default": "auto",
|
||||
},
|
||||
},
|
||||
mutually_exclusive=(["privatekey_path", "privatekey_content"],),
|
||||
required_one_of=(["privatekey_path", "privatekey_content"],),
|
||||
supports_check_mode=True,
|
||||
|
||||
Reference in New Issue
Block a user