Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catching internal Ansible exceptions #1

Closed
davidBMSTU opened this issue Nov 8, 2023 · 0 comments · Fixed by #2
Closed

Catching internal Ansible exceptions #1

davidBMSTU opened this issue Nov 8, 2023 · 0 comments · Fixed by #2
Assignees

Comments

@davidBMSTU
Copy link
Collaborator

davidBMSTU commented 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).

@davidBMSTU davidBMSTU changed the title Catching Ansible exceptions Catching internal Ansible exceptions Nov 8, 2023
@SegFaulti4 SegFaulti4 self-assigned this Jan 17, 2024
@SegFaulti4 SegFaulti4 linked a pull request Jan 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants