Prevent losing error info by including both loop and cond error msgs (#68485)
Fixes #66529
This commit is contained in:
parent
1e01ac413b
commit
061c6c7c6f
2 changed files with 6 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- Prevent losing useful error information by including both the loop and the conditional error messages (https://github.com/ansible/ansible/issues/66529)
|
|
@ -562,9 +562,12 @@ class TaskExecutor:
|
|||
if not self._task.evaluate_conditional(templar, variables):
|
||||
display.debug("when evaluation is False, skipping this task")
|
||||
return dict(changed=False, skipped=True, skip_reason='Conditional result was False', _ansible_no_log=self._play_context.no_log)
|
||||
except AnsibleError:
|
||||
except AnsibleError as e:
|
||||
# loop error takes precedence
|
||||
if self._loop_eval_error is not None:
|
||||
# Display the error from the conditional as well to prevent
|
||||
# losing information useful for debugging.
|
||||
display.v(to_text(e))
|
||||
raise self._loop_eval_error # pylint: disable=raising-bad-type
|
||||
raise
|
||||
|
||||
|
|
Loading…
Reference in a new issue