Report async task failures better

We were previously trying to reach into `.rc`,
but there's no such thing if `async_result.finished == 0`.

Fixes https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/2153
This commit is contained in:
Slavi Pantaleev 2022-10-06 10:03:16 +03:00
parent ff2afacc66
commit d1b5681ba0
4 changed files with 9 additions and 4 deletions

View file

@ -108,4 +108,5 @@
async: "{{ postgres_import_wait_time }}"
poll: 10
register: matrix_postgres_import_postgres_command_result
changed_when: matrix_postgres_import_postgres_command_result.rc == 0
failed_when: not matrix_postgres_import_postgres_command_result.async_result.finished
changed_when: matrix_postgres_import_postgres_command_result.async_result.finished and matrix_postgres_import_postgres_command_result.rc == 0

View file

@ -78,7 +78,8 @@
async: "{{ postgres_vacuum_wait_time }}"
poll: 10
register: matrix_postgres_synapse_vacuum_result
changed_when: matrix_postgres_synapse_vacuum_result.rc == 0
failed_when: not matrix_postgres_synapse_vacuum_result.async_result.finished
changed_when: matrix_postgres_synapse_vacuum_result.async_result.finished and matrix_postgres_synapse_vacuum_result.rc == 0
# Intentionally show the results
- ansible.builtin.debug: var="matrix_postgres_synapse_vacuum_result"

View file

@ -21,7 +21,8 @@
async: "{{ matrix_synapse_rust_synapse_compress_state_compress_room_time }}"
poll: 10
register: matrix_synapse_rust_synapse_compress_state_compress_room_command_result
changed_when: matrix_synapse_rust_synapse_compress_state_compress_room_command_result.rc == 0
failed_when: not matrix_synapse_rust_synapse_compress_state_compress_room_command_result.async_result.finished
changed_when: matrix_synapse_rust_synapse_compress_state_compress_room_command_result.async_result.finished and matrix_synapse_rust_synapse_compress_state_compress_room_command_result.rc == 0
- ansible.builtin.debug: var="matrix_synapse_rust_synapse_compress_state_compress_room_command_result"
@ -44,7 +45,8 @@
async: "{{ matrix_synapse_rust_synapse_compress_state_psql_import_time }}"
poll: 10
register: matrix_synapse_rust_synapse_compress_state_psql_import_command_result
changed_when: matrix_synapse_rust_synapse_compress_state_psql_import_command_result.rc == 0
failed_when: not matrix_synapse_rust_synapse_compress_state_psql_import_command_result.async_result.finished
changed_when: matrix_synapse_rust_synapse_compress_state_psql_import_command_result.async_result.finished and matrix_synapse_rust_synapse_compress_state_psql_import_command_result.rc == 0
- name: Clean up
ansible.builtin.file:

View file

@ -70,6 +70,7 @@
async: "{{ matrix_synapse_rust_synapse_compress_state_find_rooms_command_wait_time }}"
poll: 10
register: matrix_synapse_rust_synapse_compress_state_find_rooms_command_result
failed_when: not matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.async_result.finished
changed_when: false
# We expect the output to be like this: