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
Fully qualified collection name automatically stripped away from matchtask #1587
Comments
That is related to a change made one day before you filed it, https://github.com/ansible-community/ansible-lint/pull/1581/files -- mainly we consider the normalized name to be the short form not the long one. That is because we have a huge number of places where the short/old name is used. Still, if you want to make a PR to switch normalized form to be the long one and replace all occurrences in the code to use long ones you care welcome. Keep in mind NOT to do replacement for tests. For tests you will likely want to add extra checks to also include for fully qualified names, in addition to existing ones. While Ansible core team already replaced module calls with long form in the docs, there are longer debates regarding if we do really need this kind of verbosity for builtins. That is the reason why we did not make a rule that forces people to use only full names. Still, if you want to add one and make it an opt-in, I would not refuse you, especially as we may go towards this direction in the future anyway. |
Thanks for your input, I understand that having the short form as the normalized one helps to have current code about specific builtins working without having to refactor a huge amount of code. Actually, normalizing to the long name wouldn't help here as we wouldn't find anything with our rule (as all the short names already got transformed to their long version). |
Fixed with #1614 |
Summary
We are currently using a rule that doesn't exist upstream to check whether we use the fully qualified collection name for builtins, as we recently migrated to fully qualified collection name and have integrated a check to CI to be consistent here.
Code of it is seen below:
Our problem is now that #1581 got merged,
task["action"]["__ansible_module__"]
will falsely flag basically all of our roles, with https://github.com/ansible-community/ansible-lint/pull/1581/files#diff-d453523679145f511ca4e8fb97be96e7dd664ae88373e2e5e9a90a65fd751cabR562 as the exact line of this problem.If you would be fine with expanding the normalization to also include the unnormalized way (e.g. as seen in desired behavior) I can happily create a PR for that.
Issue Type
Ansible and Ansible Lint details
STEPS TO REPRODUCE
I hope this is not really needed as I pointed to the related MR.
Desired Behaviour
Have a
task["action"]["__ansible_module_original__"]
to check against the exact name that we have in the roleActual Behaviour
task["action"]["__ansible_module__"]
only contains the base name and it is not possible to derive from thetask
dictionary whether a fully qualified name was used or notThe text was updated successfully, but these errors were encountered: