Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ansible-lint[risky-shell-pipe] misinterprets pipe in comment when using Multiline Block Scalars #4262

Open
jedthe3rd opened this issue Jul 16, 2024 · 1 comment
Assignees
Labels

Comments

@jedthe3rd
Copy link

jedthe3rd commented Jul 16, 2024

Summary

The ansible-lint[risky-shell-pipe] rule misinterprets pipe in comment when using Multiline Block Scalars ( | or > )

Issue Type
  • Bug Report
OS / ENVIRONMENT
> ansible-lint --version
ansible-lint 24.7.0 using ansible-core:2.17.1 ansible-compat:24.7.0 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
  • ansible installation method: ansible-dev-tools devcontainer - ghcr.io/ansible/community-ansible-dev-tools:latest
  • ansible-lint installation method: ansible-dev-tools devcontainer - ghcr.io/ansible/community-ansible-dev-tools:latest
STEPS TO REPRODUCE

Create the below test.yml and run it through the linter

---
- name: "Write crontab header for {{ postgresql_svc_user }}"
  become: true
  ansible.builtin.shell: |
    cat <<EOF >> crontab_temp.txt ##    |    +---------------- hour (0 - 23)
  changed_when: true
...
Desired Behavior

Expected behavior is the pipes in comments are interpreted correctly and not flagged for risky-shell-pipe rule.

Actual Behavior

image

@cidrblock
Copy link
Contributor

+100 for using the devtools container, ty for that!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

4 participants