Properly fail playbook when vault_restore.sh fails
Currently, when the main restore script vault_restore.sh fails, it goes to the rescue block to delete the vault workdir. As ansible treats the script block not as "failed", the playbook is not considered failed as well. Now the rescue block is removed and vault workdir deletion is moved under the always block, the playbook should properly fail when the script as failed. Test Plan: PASS The playbook fails with failed=1 when the script exits with 1 PASS Vault workdir is deleted for both playbook failure and success Story: 2011073 Task: 50971 Change-Id: Id6dd31852cc17da8f09d3e33bc7aae09d7969782 Signed-off-by: Tae Park <tae.park@windriver.com>
This commit is contained in:
parent
0afb0aa4da
commit
620d6f6405
@ -59,16 +59,8 @@
|
||||
shell: >-
|
||||
kubectl exec -n "vault" "{{ vault_manager_pod_name.stdout }}" --
|
||||
bash -c "source /opt/script/init.sh; if [ -f $PAUSEFILE ]; then rm -f $PAUSEFILE; fi" 2>&1
|
||||
rescue:
|
||||
- name: Clean up vault subdir if in standalone mode
|
||||
- name: Clean up vault subdir
|
||||
file:
|
||||
path: "{{ vault_backup_dir }}"
|
||||
state: absent
|
||||
when: op_mode == "standalone"
|
||||
become: yes
|
||||
|
||||
- name: Cleanup vault subdir
|
||||
file:
|
||||
path: "{{ vault_backup_dir }}"
|
||||
state: absent
|
||||
become: yes
|
||||
|
Loading…
x
Reference in New Issue
Block a user