Ansible error handling rescue block does not have any indication that the block's failure is being handled by rescue. #39227
Labels
affects_2.5
This issue/PR affects Ansible v2.5
bug
This issue/PR relates to a bug.
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
ISSUE TYPE
COMPONENT NAME
playbook/block.py
ANSIBLE VERSION
CONFIGURATION
N/A
OS / ENVIRONMENT
N/A
SUMMARY
Ansible error handling rescue block does not give any indication in the output log, that the block's failure is being handled in rescue. Rather the output logs show that one task has failed, but still it is continuing the execution with next task. Just by looking at the logs it does not give any information that rescue tasks are under execution unless we add debug task indicating the same (or) by browsing through the playbooks. This make life difficult in debugging playbooks with multiple roles in identify real failure.
If we take the example of retry tasks failures have clear prefix "FAILED - RETRYING: ", if we take the "ignore_errors" case there is a clear print statement "...ignoring" before proceeding to the next task. It would make debugging easy if we have similar sort of indication for block-rescue tasks as well.
STEPS TO REPRODUCE
Run the below playbook with ansible-playbook command.
EXPECTED RESULTS
ACTUAL RESULTS
[root@controller-1 playbooks]# ansible-playbook test.yaml
[WARNING]: provided hosts list is empty, only localhost is available
PLAY [Testing block-rescue] ************************************************************************************************************************************
TASK [Gathering Facts] *****************************************************************************************************************************************
ok: [localhost]
TASK [read /tmp/test.data] *************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "file not found: /tmp/test.data"}
TASK [create /tmp/test.data] ***********************************************************************************************************************************
changed: [localhost]
PLAY RECAP *****************************************************************************************************************************************************
localhost : ok=3 changed=1 unreachable=0 failed=1
[root@controller-1 playbooks]# echo $?
0
The text was updated successfully, but these errors were encountered: