diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:06:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:06:49 +0000 |
commit | 2fe34b6444502079dc0b84365ce82dbc92de308e (patch) | |
tree | 8fedcab52bbbc3db6c5aa909a88a7a7b81685018 /examples/playbooks/rule-risky-shell-pipe-pass.yml | |
parent | Initial commit. (diff) | |
download | ansible-lint-2fe34b6444502079dc0b84365ce82dbc92de308e.tar.xz ansible-lint-2fe34b6444502079dc0b84365ce82dbc92de308e.zip |
Adding upstream version 6.17.2.upstream/6.17.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | examples/playbooks/rule-risky-shell-pipe-pass.yml | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/examples/playbooks/rule-risky-shell-pipe-pass.yml b/examples/playbooks/rule-risky-shell-pipe-pass.yml new file mode 100644 index 0000000..386e8e8 --- /dev/null +++ b/examples/playbooks/rule-risky-shell-pipe-pass.yml @@ -0,0 +1,70 @@ +--- +- name: Test fixture for risky-shell-pipe + hosts: localhost + become: false + tasks: + - name: Pipeline with pipefail + ansible.builtin.shell: set -o pipefail && false | cat + changed_when: false + + - name: Pipeline with pipefail, multi-line + ansible.builtin.shell: | + set -o pipefail + false | cat + changed_when: false + + - name: Pipeline with pipefail, complex set + ansible.builtin.shell: | + set -e -x -o pipefail + false | cat + changed_when: false + + - name: Pipeline with pipefail, complex set + ansible.builtin.shell: | + set -e -x -o pipefail + false | cat + changed_when: false + + - name: Pipeline with pipefail, complex set + ansible.builtin.shell: | + set -eo pipefail + false | cat + changed_when: false + + - name: Pipeline with pipefail not at first line + ansible.builtin.shell: | + echo foo + set -eo pipefail + false | cat + changed_when: false + + - name: Pipeline without pipefail, ignoring errors # noqa: risky-shell-pipe + ansible.builtin.shell: false | cat + failed_when: false + changed_when: false + + - name: Non-pipeline without pipefail # noqa: command-instead-of-shell + ansible.builtin.shell: "true" + changed_when: false + + - name: Command without pipefail + ansible.builtin.command: "true" + changed_when: false + + - name: Shell with or + ansible.builtin.shell: false || true + changed_when: false + + - name: Another one + ansible.builtin.shell: | + set -o pipefail + df | grep '/dev' + changed_when: false + + - name: "PowerShell with pipefail should be ok, bug #3161" + # https://github.com/ansible/ansible-lint/issues/3161 + ansible.builtin.shell: + executable: /bin/pwsh + cmd: | + $ProgressPreference = 'this | that' + changed_when: false |