You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ansible is launched by cotea in a different thread hence the internal Ansible exceptions can't be caught in the main cotea thread. Yeah, the internal Ansible exceptions occur rarely, but they do.
These can be solved by catching the exceptions in the wrappers code because wrappers are executed in the Ansible thread. After the exception was caught, it can be 'transferred' to the cotea thread using the decorator class fields. In this solution the check of the exceptions (of the decorator class fields) should be done in all the methods, that wake up Ansible thread (has_next_play, has_next_task, run_next_task and finish_ansible). Further the exception can be just raised in the main cotea thread. This will allow one to catch Ansible internal exceptions too while using the try/except block with cotea interfaces.
Currently I don't have enough time to do it and any contributions are welcomed (we have a contributing guide).
The text was updated successfully, but these errors were encountered:
davidBMSTU
changed the title
Catching Ansible exceptions
Catching internal Ansible exceptions
Nov 8, 2023
Ansible is launched by cotea in a different thread hence the internal Ansible exceptions can't be caught in the main cotea thread. Yeah, the internal Ansible exceptions occur rarely, but they do.
These can be solved by catching the exceptions in the wrappers code because wrappers are executed in the Ansible thread. After the exception was caught, it can be 'transferred' to the cotea thread using the decorator class fields. In this solution the check of the exceptions (of the decorator class fields) should be done in all the methods, that wake up Ansible thread (has_next_play, has_next_task, run_next_task and finish_ansible). Further the exception can be just raised in the main cotea thread. This will allow one to catch Ansible internal exceptions too while using the try/except block with cotea interfaces.
Currently I don't have enough time to do it and any contributions are welcomed (we have a contributing guide).
The text was updated successfully, but these errors were encountered: