forked from redhat-cop/infra.aap_configuration
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Idea of managing errors while creating the objects in controller (red…
…hat-cop#862) * feat: error handling for job templates * fix: remove garbage * misc: rename variables * fix: missing dots * feat: test for error handling of JT * fix: path to async file * fix: typo file name * misc: moving error handling test to proper file * refactor error handling tests * fix testing section * fix: issue when variables are defined somewhere in job template --------- Co-authored-by: Przemyslaw Kalitowski <[email protected]> Co-authored-by: Tom Page <[email protected]>
- Loading branch information
1 parent
14c8af9
commit 244bed7
Showing
4 changed files
with
86 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
- name: Async block | ||
block: | ||
- name: "Managing Controller Job Templates | Wait for finish the Job Templates management" | ||
ansible.builtin.async_status: | ||
jid: "{{ __job_templates_job_async_result_item.ansible_job_id }}" | ||
register: __job_templates_job_async_result | ||
until: __job_templates_job_async_result.finished | ||
retries: "{{ controller_configuration_job_templates_async_retries }}" | ||
delay: "{{ controller_configuration_job_templates_async_delay }}" | ||
|
||
rescue: | ||
- name: Removing variables existance from result_file | ||
ansible.builtin.replace: | ||
path: "{{ __job_templates_job_async_result.results_file }}" | ||
regexp: '\{\{.*?\}\}' | ||
replace: '' | ||
|
||
- name: "Load error details" | ||
ansible.builtin.include_vars: | ||
file: "{{ __job_templates_job_async_result.results_file }}" | ||
name: __error_data | ||
|
||
- name: "Building list of not processed templates" | ||
ansible.builtin.set_fact: | ||
__templates_error_list: "{{ __templates_error_list | default([]) + [ { | ||
'name': __error_data['invocation']['module_args']['name'], | ||
'project_name': __error_data['invocation']['module_args']['project'], | ||
'playbook': __error_data['invocation']['module_args']['playbook'], | ||
'inventory': __error_data['invocation']['module_args']['inventory'], | ||
'credentials': __error_data['invocation']['module_args']['credentials'], | ||
'error': __error_data['msg'] | ||
} | ||
] | ||
}}" | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters