Repository navigation
Ensure SystemExit is captured on driver initialization - #3230
Conversation
Prevent a broken driver from affecting usability of molecule by catching even SystemExit. Related: ansible-community/molecule-podman#81
| try: | ||
| pm.load_setuptools_entrypoints("molecule.driver") | ||
| except Exception: | ||
| except (Exception, SystemExit): |
There was a problem hiding this comment.
@ssbarnea this doesn't catch everything, though. Is it intentional that you didn't use BaseException?
There was a problem hiding this comment.
I wasn't sure what kind of other exceptions would Base Exception catch so I went for that approach. Shortly I don't know if current code is better than just BaseException or not.
There was a problem hiding this comment.
You could catch all the exceptions excluding KeyboardInterrupt, I think.
There was a problem hiding this comment.
The whole hierarchy is documented here: https://docs.python.org/3/library/exceptions.html#exception-hierarchy
There was a problem hiding this comment.
OTOH Molecule could also define own exceptions for communicating misconfiguration clearly. In this case, you'd need something like
try:
...
except KeyboardInterrupt:
raise
except MoleculeMisconfiguredException:
report_exc()
except BaseException:
process_exc()
Prevent a broken driver from affecting usability of molecule by catching even SystemExit. Related: ansible-community/molecule-podman#81
This comment has been minimized.
This comment has been minimized.
Backport to stable/3.4: 💚 backport PR created✅ Backport PR branch: Backported as #3253 🤖 @patchback |
Prevent a broken driver from affecting usability of molecule by catching even SystemExit. Related: ansible-community/molecule-podman#81 (cherry picked from commit 5e717ce)
Prevent a broken driver from affecting usability of molecule by catching even SystemExit. Related: ansible-community/molecule-podman#81 (cherry picked from commit 5e717ce)
Prevent a broken driver from affecting usability of molecule by catching even SystemExit.
Related: ansible-community/molecule-podman#81