Skip to content

Commit 7063491

Browse files
authored
Update playbooks_error_handling.rst (#1982)
Closes #1895. Correct example so it behaves as described in the docs. The message "No such file or directory" is sent to stderr, not to stdout.
1 parent 6ce04d5 commit 7063491

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/docsite/rst/playbook_guide/playbooks_error_handling.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ You can also combine multiple conditions for failure. This task will fail if bot
116116
register: result
117117
failed_when:
118118
- result.rc == 0
119-
- '"No such" not in result.stdout'
119+
- '"No such" not in result.stderr'
120120
121121
If you want the task to fail when only one condition is satisfied, change the ``failed_when`` definition to
122122

123123
.. code-block:: yaml
124124
125-
failed_when: result.rc == 0 or "No such" not in result.stdout
125+
failed_when: result.rc == 0 or "No such" not in result.stderr
126126
127127
If you have too many conditions to fit neatly into one line, you can split it into a multi-line YAML value with ``>``.
128128

0 commit comments

Comments
 (0)