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

False positive: deprecated-bare-vars for with_community.general.filetree #3646

Closed
pavelzw opened this issue Aug 4, 2023 · 1 comment · Fixed by #3709
Closed

False positive: deprecated-bare-vars for with_community.general.filetree #3646

pavelzw opened this issue Aug 4, 2023 · 1 comment · Fixed by #3709
Assignees
Labels

Comments

@pavelzw
Copy link

pavelzw commented Aug 4, 2023

Summary

Same issue as #1621.

When using with_community.general.filetree, I get a deprecated-bare-vars

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint --version
ansible-lint 6.17.2 using ansible-core:2.15.2 ansible-compat:4.1.2 ruamel-yaml:0.17.32 ruamel-yaml-clib:0.2.7
  • ansible installation method: homebrew
  • ansible-lint installation method: homebrew

macOS 13 (ARM)

STEPS TO REPRODUCE
# test.yml
- name: Test
  hosts: localhost
  tasks:
    - name: Test
      ansible.builtin.file:
        path: /web/{{ item.path }}
        state: directory
        mode: '{{ item.mode }}'
      with_community.general.filetree: web/
      when: item.state == 'directory'
Desired Behavior

It should not complain since this is not a variable but a path

Actual Behavior
ansible-lint test.yaml
WARNING  Listing 1 violation(s) that are fatal
deprecated-bare-vars: Possible bare variable 'web/' used in a 'with_community.general.filetree' loop. You should use the full variable syntax ('{{ web/ }}') or convert it to a list if that is not really a variable.
test.yaml:4 Task/Handler: Test

Read documentation for instructions on how to ignore specific rule violations.

                 Rule Violation Summary                  
 count tag                  profile rule associated tags 
     1 deprecated-bare-vars basic   deprecations         

Failed: 1 failure(s), 0 warning(s) on 1 files. Last profile that met the validation criteria was 'min'.
@pavelzw pavelzw added bug new Triage required labels Aug 4, 2023
@benedikt-bartscher
Copy link

I am having a similar issue:

- name: Create SpaceVim.d and subdirectories
  ansible.builtin.file:
    path: "{{ SPACEVIM_D_DIR }}/{{ item.path }}"
    state: directory
    mode: "{{ item.mode }}"
  with_community.general.filetree:
    - "../templates/SpaceVim.d/"
  when: item.state == "directory" and ".git" not in item.path

results in this error

deprecated-bare-vars: Possible bare variable '['../templates/SpaceVim.d/']' used in a 'with_community.general.filetree' loop. You should use the full variable syntax ('{{ ['../templates/SpaceVim.d/'] }}') or convert it to a list if that is not really a variable. (warning) # ignored
roles/nvim/tasks/main.yml:146 Task/Handler: Create SpaceVim.d and subdirectories

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