You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Role variable prefix does not work if var_naming_pattern: has been altered from its default.
#Bradley Thornton has requested me to create this as a bug.
If the var_naming_pattern setting in .ansible-lint.cfg file is changed from its default
and you create a role and use set_fact to set a variable
The rules var-naming[no-role-prefix] and var-naming[pattern] will collide as both scenarios can not be fulfilled
Issue Type
Bug Report
OS / ENVIRONMENT
ansible-lint --versionansible-lint 24.2.3 using ansible-core:2.16.6 ansible-compat:4.1.11 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
var-naming[no-role-prefix]: Variables names from within roles should use register_dns_host_record_ as a prefix. (vars: Register_DNS_Host_Record_Variable)
The text was updated successfully, but these errors were encountered:
The var-naming[no-role-prefix] rule checks that role variables start with the role name exactly, i.e. including case. This is intentional to ensure consistency and clarity of role variables.
I can see in this case why you might want to use different casing, even if the prefix is otherwise the same, but we do not presently support this and are not planning on working on it at present. However, we do always welcome community contributions, and if you put together a PR, we will absolutely consider it.
Summary
Role variable prefix does not work if var_naming_pattern: has been altered from its default.
#Bradley Thornton has requested me to create this as a bug.
If the var_naming_pattern setting in .ansible-lint.cfg file is changed from its default
and you create a role and use set_fact to set a variable
The rules var-naming[no-role-prefix] and var-naming[pattern] will collide as both scenarios can not be fulfilled
Issue Type
OS / ENVIRONMENT
STEPS TO REPRODUCE
update .ansible-lint with the below setting
Add a variable to the role vars main.yml file
Run ansible-lint on the new role
ansible-lint /collections/mynamespace/network/roles/register_dns_host_record
Desired Behavior
No errors should be reported
Actual Behavior
var-naming[no-role-prefix]: Variables names from within roles should use register_dns_host_record_ as a prefix. (vars: Register_DNS_Host_Record_Variable)
The text was updated successfully, but these errors were encountered: