Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelogs/fragments/1267-improve-error-messages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
bugfixes:
- Improve error messages in collect_async_status by checking detail and error keys before falling back to Unknown Error.
...
4 changes: 2 additions & 2 deletions roles/collect_async_status/tasks/handle_error.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- name: handle_error | Show error and stop execution
when: not aap_configuration_collect_logs | default(false) | bool
ansible.builtin.fail:
msg: "error: {{ __cas_job_async_result['msg'] | default('Unknown Error') }}"
msg: "error: {{ __cas_job_async_result['msg'] | default(__cas_job_async_result['detail'] | default(__cas_job_async_result['error'] | default('Unknown Error'))) }}"

- name: handle_error | Set item details fact
ansible.builtin.set_fact:
Expand Down Expand Up @@ -109,7 +109,7 @@
}}"
vars:
__new_error:
ERROR_MESSAGE: "{{ __cas_job_async_result['msg'] | default('UNKNOWN ERROR') }}"
ERROR_MESSAGE: "{{ __cas_job_async_result['msg'] | default(__cas_job_async_result['detail'] | default(__cas_job_async_result['error'] | default('UNKNOWN ERROR'))) }}"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to put all 3 if they are defined? instead of defaulting to one?

name: "{{ __cas_job_async_item['name'] | default(omit) }}"
organization: "{{ __cas_job_async_item['organization'] | default(omit) }}"
hostname: "{{ __cas_job_async_item['hostname'] | default(omit) }}"
Expand Down