Skip to content

Commit a72212a

Browse files
author
Dylan Morroll
committed
chore: Updated some of the docs and messages around setting pipefail.
Setting pipefail necessitates other changes away from the default functioning of ansible, this is made more explicit to the user.
1 parent 51cf2dd commit a72212a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/ansiblelint/rules/risky_shell_pipe.md

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ The return status of a pipeline is the exit status of the command. The
77
`pipefail` option ensures that tasks fail as expected if the first command
88
fails.
99

10+
This does not work in the standard (POSIX) shell. You will need to set the executable
11+
to a different shell, such as bash. See the example below.
12+
1013
As this requirement does not apply to PowerShell, for shell commands that have
1114
`pwsh` inside `executable` attribute, this rule will not trigger.
1215

src/ansiblelint/rules/risky_shell_pipe.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
class ShellWithoutPipefail(AnsibleLintRule):
18-
"""Shells that use pipes should set the pipefail option."""
18+
"""Shells that use pipes should set the pipefail option. NB: This requires changing the shell, see the docs."""
1919

2020
id = "risky-shell-pipe"
2121
description = (
@@ -24,7 +24,8 @@ class ShellWithoutPipefail(AnsibleLintRule):
2424
"any part of the pipeline other than the terminal command "
2525
"fails, the whole pipeline will still return 0, which may "
2626
"be considered a success by Ansible. "
27-
"Pipefail is available in the bash shell."
27+
"Pipefail is not available in the default (POSIX) shell, "
28+
"consider bash."
2829
)
2930
severity = "MEDIUM"
3031
tags = ["command-shell"]

0 commit comments

Comments
 (0)