Skip to content

Commit

Permalink
Fix patterns used to identify var files
Browse files Browse the repository at this point in the history
Fixes: #1357
  • Loading branch information
ssbarnea committed Feb 17, 2021
1 parent 3100caf commit c2e8402
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/group_vars/all.yml
@@ -0,0 +1 @@
some_var: some_value_defined_in_group_vars_all
1 change: 1 addition & 0 deletions examples/host_vars/localhost.yml
@@ -0,0 +1 @@
some_var: some_value_defined_in_host_vars_localhost
1 change: 1 addition & 0 deletions examples/playbooks/vars/subfolder/settings.yml
@@ -0,0 +1 @@
some_var: some_value_defined_in_vars_subfolder_settings
2 changes: 1 addition & 1 deletion src/ansiblelint/config.py
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
3 changes: 3 additions & 0 deletions test/TestUtils.py
Expand Up @@ -349,6 +349,9 @@ 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/subfolder/settings.yml", "vars"), # deep vars
),
)
def test_auto_detect(monkeypatch, path: str, kind: FileType) -> None:
Expand Down

0 comments on commit c2e8402

Please sign in to comment.