1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #13334: Record error message on failed jobs (#14106)

This commit is contained in:
Jeremy Stretch
2023-10-31 08:34:57 -04:00
committed by GitHub
parent edc4a35296
commit 7323668dd0
9 changed files with 40 additions and 9 deletions

View File

@ -519,7 +519,7 @@ def run_script(data, request, job, commit=True, **kwargs):
logger.error(f"Exception raised during script execution: {e}")
script.log_info("Database changes have been reverted due to error.")
job.data = ScriptOutputSerializer(script).data
job.terminate(status=JobStatusChoices.STATUS_ERRORED)
job.terminate(status=JobStatusChoices.STATUS_ERRORED, error=str(e))
clear_webhooks.send(request)
logger.info(f"Script completed in {job.duration}")