Fix leases remaining incomplete indefinitely when bot-related exceptions occur
Description
Currently, jobs hang indefinitely if the bot raises an exception in the process of running. This MR adds some exception handling to the complete_lease callback, so that the lease state gets set to COMPLETED even when an exception is raised. It also fixes some issues in the run_work coroutine itself, whereby it tried to reference an undefined variable when handling exceptions.
Changes proposed in this merge request:
- tenantmanager.py: Handle exceptions in complete_lease
- tenant.py: Fix exception handling in run_work
This merge request, when merged, will address issue/bug:
I think that the issue described in #166 (closed) is the same one I encountered and wrote this patch to resolve.