-
Notifications
You must be signed in to change notification settings - Fork 664
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
Ansible Lint misclassifies template folders as roles #1753
Comments
Indeed this looks like the something sorted like you mentioned and it should be quite easy to include a test for it. I would start adding the files/folder inside examples for replicating the bug first. |
Replicating this issue with pure folders is not possible. Because Ansible Lint uses git to get a list of files it should inspect, we would need to add a "git boundary" to the folder. Git itself will never report folders in the listing since they contain no content which is what git tracks. |
I think it would be ok to ignore templates. Feel free to add a new pattern for that. I think that there are just too many cases where linter would choke on templates, even simple yamllint execution is likely to fail with some templated files. |
Summary
When linting roles, Ansible Lint will misclassify subdirectories in the
templates
directory as roles.Issue Type
Ansible and Ansible Lint details
OS / ENVIRONMENT
Fedora 34
STEPS TO REPRODUCE
The output we get is something like this:
Desired Behaviour
Ansible Lint should ignore anything in the templates directory (and probably also in all other standard role directories).
Actual Behaviour
Ansible Lint treats the subdirectory as a role and outputs all kinds of nonsense when trying to lint unstructured files.
Additional data
The source of the issue is the kind_from_path function. Because template files and folds do not have a dedicated entry in DEFAULT_KINDS, directories under
templates
classify as roles. We could probably solve this by adding an entry like{"template": "**/templates/*"}
toDEFAULT_KINDS
, but I did not test this nor did I think much about the consequences this addition might have on the linter.This issue was discovered by Amin and reported via IRC. Thank you, Amin!
The text was updated successfully, but these errors were encountered: