Skip to content

Commit 15bf3a5

Browse files
committed
Fixes #13369: Fix job termination status for failed reports
1 parent a807cca commit 15bf3a5

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

netbox/extras/reports.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -214,20 +214,18 @@ def run(self, job):
214214
self.active_test = method_name
215215
test_method = getattr(self, method_name)
216216
test_method()
217+
job.data = self._results
217218
if self.failed:
218219
self.logger.warning("Report failed")
219-
job.status = JobStatusChoices.STATUS_FAILED
220+
job.terminate(status=JobStatusChoices.STATUS_FAILED)
220221
else:
221222
self.logger.info("Report completed successfully")
222-
job.status = JobStatusChoices.STATUS_COMPLETED
223+
job.terminate()
223224
except Exception as e:
224225
stacktrace = traceback.format_exc()
225226
self.log_failure(None, f"An exception occurred: {type(e).__name__}: {e} <pre>{stacktrace}</pre>")
226227
logger.error(f"Exception raised during report execution: {e}")
227228
job.terminate(status=JobStatusChoices.STATUS_ERRORED)
228-
finally:
229-
job.data = self._results
230-
job.terminate()
231229

232230
# Perform any post-run tasks
233231
self.post_run()

0 commit comments

Comments
 (0)