Skip to content

Commit

Permalink
Include ! as a shell word. closes #4386 (#4403)
Browse files Browse the repository at this point in the history
  • Loading branch information
wimglenn authored Nov 14, 2024
1 parent 44be233 commit 2e5af42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions examples/playbooks/rule-command-instead-of-shell-pass.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@
set -x
ls foo?
changed_when: false

- name: Use ! for negation
ansible.builtin.shell:
cmd: "! crontab -l"
changed_when: false
2 changes: 1 addition & 1 deletion src/ansiblelint/rules/command_instead_of_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def matchtask(
return False

jinja_stripped_cmd = self.unjinja(get_cmd_args(task))
return not any(ch in jinja_stripped_cmd for ch in "&|<>;$\n*[]{}?`")
return not any(ch in jinja_stripped_cmd for ch in "&|<>;$\n*[]{}?`!")
return False

def transform(
Expand Down

0 comments on commit 2e5af42

Please sign in to comment.