ansible-lint
ansible-lint copied to clipboard
Ignore var-naming[pattern] to foreign role vars
Fixes #4095.
When working on this issue, I ran into another bug when writing a test case to test my solution to the issue. The bug I ran into was when running a test case that would lint a playbook from ./examples/playbooks
that contained a include_role
/import_role
task with a FQCN role as its argument. I noticed that the test case would pick up violations from other lintables that I didn't specify as an argument to my runner
instance. I suspect this is because _rolepath
currently doesn't handle FQCNs, which results in the basedir
being returned and can cause _look_for_role_files
to return additional unexpected files. This can be seen when running pytest test/test_utils.py::test_find_children_in_playbook
from another fork branch I made to showcase this https://github.com/cavcrosby/ansible-lint/tree/ignore-foreign-role-vars-revert-utils. The changes to fix said bug are consolidated into utils.py
.
To add, said bug probably won't affect an end user unless they purposefully contain violations in their Ansible yaml like in the case of ansible-lint
. That said, I would think we would want to address this for development purposes.