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

var_naming_pattern not working for set_fact #2065

Closed
SpikePy opened this issue Apr 4, 2022 · 2 comments · Fixed by #2496
Closed

var_naming_pattern not working for set_fact #2065

SpikePy opened this issue Apr 4, 2022 · 2 comments · Fixed by #2496
Labels

Comments

@SpikePy
Copy link

SpikePy commented Apr 4, 2022

Summary

var_naming_pattern is buggy for set_fact variables

Issue Type
  • Bug Report
Ansible and Ansible Lint details

ansible-lint --version

ansible-lint 6.0.2 using ansible 2.12.4
STEPS TO REPRODUCE

.ansible-lint file:

var_naming_pattern: "^[a-z][a-z0-9_]*[a-z0-9]__[a-z][a-z0-9_]*[a-z0-9]$"

in a role set a variable in defaults/main.yml to:

k8s_grafana_users__namespace: monitoring

in tasks/main.yml set:

- name: foobar
  ansible.builtin.set_fact:
    k8s_grafana_users__namespace: "foo"
Desired Behavior

no error regarding variable pattern neither in defaults nor in the tasks file

Actual Behavior
var-naming: Task uses 'set_fact' to define variables that violates variable naming standards
tasks/main.yml:2 Task/Handler: foobar

defaults/main.yml is ok but set_fact variable with the same name is not ok!

@SpikePy SpikePy added bug new Triage required labels Apr 4, 2022
@ssbarnea ssbarnea removed the new Triage required label Apr 6, 2022
@ssbarnea
Copy link
Member

ssbarnea commented Apr 6, 2022

This looks like a good idea, a pull-requests would be welcomed.

@nishipy
Copy link
Contributor

nishipy commented Aug 2, 2022

Hi team, if no one hasn't started to work on this, I'd like to take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants