-
Notifications
You must be signed in to change notification settings - Fork 24k
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
Collection loader: importing from module_utils/foo/__init__.py does not work #68872
Comments
Files identified in the description: If these files are incorrect, please update the |
@felixfontein Non-empty
|
Ah, that's good to know! I never came that far since I didn't try running any tests except integration tests locally, and these already failed because of this. I've now also found it in the docs: |
@mattclay i don't think we can do that. Putting things in Since collections are even more outside of the ansible scope than what was in core, it policies won't apply there and people will want to do this even more. So i think this needs to work for collections just as i supported it working in ansible/ansible when i wrote ansiballz |
Nitzmahone also acknowledged this as a bug when i talked to him on Monday. He had written an integration test for it but commented it out with a note to fix it later but forgot about it. |
@abadger I didn't mean to suggest we shouldn't allow it. I only meant to point out that it's currently something that is reported as an error in the |
SUMMARY
During some refactoring I tried to rename
plugins/module_utils/crypto.py
toplugins/module_utils/crypto/__init__.py
in community.crypto, assuming that this does not change behavior for any module using this module_utils. Unfortunately, that does not work: whilefrom ansible_collections.community.crypto.plugins.module_utils import crypto as crypto_utils
works fine,from ansible_collections.community.crypto.plugins.module_utils.crypto import CRYPTOGRAPHY_HAS_X25519
makes the task fail with:As @abadger pointed out, there are explicit tests in ansible/ansible which test this for module_utils inside ansible/ansible itself:
There seem to be no similar tests for collection module_utils, as these will apparently fail.
CC @mattclay @nitzmahone
ISSUE TYPE
COMPONENT NAME
collection loader
ANSIBLE VERSION
The text was updated successfully, but these errors were encountered: