Skip to content
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

Make sure private underscore prefixed variables are not overridable by the user #4104

Open
gardar opened this issue Apr 10, 2024 · 1 comment
Labels

Comments

@gardar
Copy link

gardar commented Apr 10, 2024

Summary

Followup to #3452 and #3760

As underscore prefixed variables are supposed to be private/internal it would be great if the var-naming rule would make sure that the underscore prefixed variables can't be overridden (not defined in defaults/ )

It would also be great if it would be possible to enforce the use of underscore or double underscore prefix for all variables in vars/ and variables registered with register:

@gardar gardar added bug new Triage required labels Apr 10, 2024
@ssbarnea ssbarnea removed the new Triage required label Apr 16, 2024
@cavcrosby
Copy link
Contributor

I definitely think it would be a good addition for ansible-lint to throw violations if private/internal variables are set externally from the role. That said, I do initially think enforcing all variables under vars to be prefixed with an underscore to be a bit heavy-handed. I say this because I am under the impression variables under vars are just not typically overwritten, rather than that they shouldn't be. I suppose enforcing this for variables registered with register would be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

3 participants