-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't detect cryptography even though its installed #518
Comments
Is cryptography installed on the remote host, for the Python and user that is used by ansible? |
I've taken a prompt look at this. ...
try:
import lib_name
except ImportError as import_exc:
LIB_NAME_IMPORT_ERROR = import_exc
from traceback import format_exception
else:
LIB_NAME_IMPORT_ERROR = None
...
def do_runtime_interaction(..., ansible_module, ...):
...
if LIB_NAME_IMPORT_ERROR is not None: # or isinstance(LIB_NAME_IMPORT_ERROR, BaseException)
ansible_module.fail_json(
msg=missing_required_lib('lib_name'),
traceback=format_exception(LIB_NAME_IMPORT_ERROR),
)
...
... @felixfontein here's an idea for a better problem reporting idiom ^ |
yes. its always run as root. But digging a bit further into this, it seems that the problem disappears again if I downgrade cryptography. Maybe the problem lies over there and not in the detection mechanism. Although its a bit confusing that |
Sounds like it's both: the detection mechanism calls |
I created #519 to improve the error handling. |
Seems like some of the imports do in fact break with the new cryptography version: |
This sounds more like a packaging problem or a broken cryptography installation (the Rust bindinds might be missing). The modules work fine with 38.0.1, as some of the CI runs show (for example https://dev.azure.com/ansible/community.crypto/_build/results?buildId=57094&view=logs&j=5f3a012a-81d6-5fc5-a5af-5b322882411e&t=57903074-f940-517a-2092-4b13b1d0eaf0&l=582). |
Only if you rely on OS packaging and not pip. Have you tried using a virtualenv with pip-managed packages in it?
There's no such thing, it's only used at build time. But OpenSSL is indeed loaded through CFFI bindings.
Ansible Core CI and the related They are available from this index: https://spare-tire.testing.ansible.com/simple/cryptography/. @Subito you can |
The built Rust libraries still need to be loaded ar runtime, as otherwise large parts of cryptography that have been written in Rust wouldn't work anymore. |
community.crypto 2.7.1 is out which should improve error reporting in this case. Closing this issue since the underlying problem is unrelated to this collection, and the new error reporting should point that out better :) Thanks everyone! |
Looks like you're confusing the terminology, then. The Rust itself is a compiler. It produces shared objects ( |
SUMMARY
Running
acme_certificate
, I get the following error:ISSUE TYPE
COMPONENT NAME
acme_certificate
ANSIBLE VERSION
COLLECTION VERSION
OS / ENVIRONMENT
Target OS: FreeBSD 13.1
STEPS TO REPRODUCE
EXPECTED RESULTS
The cert gets fetched
ACTUAL RESULTS
I ran
ansible remote_host -m community.general.python_requirements_info -a 'dependencies=cryptography'
and got the following:If I use the openssl backend, everything works as expected
The text was updated successfully, but these errors were encountered: