Skip to content

Commit

Permalink
Fix patterns used to identify var files (#1360)
Browse files Browse the repository at this point in the history
Fixes: #1357
  • Loading branch information
ssbarnea authored Feb 17, 2021
1 parent 3100caf commit 21ab36c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
some_var: some_value_defined_in_group_vars_all
1 change: 1 addition & 0 deletions examples/host_vars/localhost.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
some_var: some_value_defined_in_host_vars_localhost
1 change: 1 addition & 0 deletions examples/playbooks/vars/other.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
some_var: some_value_defined_in_vars_other
1 change: 1 addition & 0 deletions examples/playbooks/vars/subfolder/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
some_var: some_value_defined_in_vars_subfolder_settings
2 changes: 1 addition & 1 deletion src/ansiblelint/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{"role": "**/roles/*/"},
{"tasks": "**/tasks/*.{yaml,yml}"},
{"handlers": "**/handlers/*.{yaml,yml}"},
{"vars": "**/{vars,defaults}/*.{yaml,yml}"},
{"vars": "**/{host_vars,group_vars,vars,defaults}/**/*.{yaml,yml}"},
{"meta": "**/meta/main.{yaml,yml}"},
{"yaml": ".config/molecule/config.{yaml,yml}"}, # molecule global config
{"yaml": "**/molecule/*/molecule.{yaml,yml}"}, # molecule config
Expand Down
4 changes: 4 additions & 0 deletions test/TestUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ def test_is_playbook():
# Undeterminable files:
("test/fixtures/unknown-type.yml", "yaml"),
("releasenotes/notes/run-playbooks-refactor.yaml", "reno"), # reno
("examples/host_vars/localhost.yml", "vars"),
("examples/group_vars/all.yml", "vars"),
("examples/playbooks/vars/other.yml", "vars"),
("examples/playbooks/vars/subfolder/settings.yml", "vars"), # deep vars
),
)
def test_auto_detect(monkeypatch, path: str, kind: FileType) -> None:
Expand Down

0 comments on commit 21ab36c

Please sign in to comment.