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:
Felix Fontein
2025-05-16 06:55:57 +02:00
committed by GitHub
parent a5a4e022ba
commit 44bcc8cebc
101 changed files with 1510 additions and 748 deletions

View File

@@ -256,13 +256,13 @@ def main() -> t.NoReturn:
],
)
module = argument_spec.create_ansible_module()
backend = create_backend(module, False)
backend = create_backend(module, needs_acme_v2=False)
result: dict[str, t.Any] = {}
changed = False
try:
# Get hold of ACMEClient and ACMEAccount objects (includes directory)
client = ACMEClient(module, backend)
client = ACMEClient(module=module, backend=backend)
method = module.params["method"]
result["directory"] = client.directory.directory
# Do we have to do more requests?
@@ -297,11 +297,11 @@ def main() -> t.NoReturn:
pass
# Fail if error was returned
if fail_on_acme_error and info["status"] >= 400:
raise ACMEProtocolException(module, info=info, content=data)
raise ACMEProtocolException(module=module, info=info, content=data)
# Done!
module.exit_json(changed=changed, **result)
except ModuleFailException as e:
e.do_fail(module, **result)
e.do_fail(module=module, **result)
if __name__ == "__main__":