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
auto-detect modules with collection layouts #778
Comments
@webknjaz While trying to fix this I discovered one problem inside main, where I tried to alter ANSIBLE_LIBRARY in order to make it discoverable. By the time main runs, we already imported ansible and altering it will no longer work. That is happening because we do import from ansiblelint.utils which imports from ansible. Fixing this is not very easy because we host |
@ssbarnea I think this could be done by splitting the utils. |
While spliting utils may move us into a good direction it will not be enough to address it. Mainly we are affected by ansible/ansible#69758 and we need to find a way to config Ansible to rediscover its modules after some ansible module imports already happened. |
Makes local modules available to ansible when the plugins/modules exists on disk but only if the user did not already define ANSIBLE_LIBRARY. This means that from now on users are not forced to use use the old hack of defining ANSIBLE_LIBRARY=plugins/modules before running the linter, something that made it harder to use with pre-commit, tox, CI. If the variable is already defined or the folder does not exist, nothing is done. Fixes: #778
Makes local modules available to ansible when the plugins/modules exists on disk but only if the user did not already define ANSIBLE_LIBRARY. This means that from now on users are not forced to use use the old hack of defining ANSIBLE_LIBRARY=plugins/modules before running the linter, something that made it harder to use with pre-commit, tox, CI. If the variable is already defined or the folder does not exist, nothing is done. Fixes: #778
Makes local modules available to ansible when the plugins/modules exists on disk but only if the user did not already define ANSIBLE_LIBRARY. This means that from now on users are not forced to use use the old hack of defining ANSIBLE_LIBRARY=plugins/modules before running the linter, something that made it harder to use with pre-commit, tox, CI. If the variable is already defined or the folder does not exist, nothing is done. Fixes: #778
Ansible-lint ability to just work without any extra tuning can be improved by making it automatically define
ANSIBLE_LIBRARY=plugins/modules
when the variable is not already defined.This would follow the official collection repository layout and make ansible-lint more likely work without extra configuration.
This feature should be enabled only with auto-detection mode because it needs to know what is the repository root location. That is because the tool could be called from any subdirectory and we do expect to give the same kind of results.
When implement this feature should allow people to remove extra code added to files like
tox.ini
or.pre-commit-config.yaml
that define ANSIBLE_LIBRARY in order to be able perform the linting.The text was updated successfully, but these errors were encountered: