-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
severity: lowDoes not significantly disrupt application functionality, or a workaround is availableDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Description
Deployment Type
Self-hosted
NetBox Version
v4.1.1
Python Version
3.10
Steps to Reproduce
This problem is a result of jobs which do not have an associated object_type in the job model. The get_absolute_url() method will fail preventing the jobs page from loading in the Netbox GUI.
This problem should be reproducible by uploading the following script, then delete it before it finishes. Afterwards, try navigating to Operations -> Jobs page.
jobs model - method fails if object_type does not exist
def get_absolute_url(self):
# TODO: Employ dynamic registration
if self.object_type.model == 'reportmodule':
return reverse(f'extras:report_result', kwargs={'job_pk': self.pk})
if self.object_type.model == 'scriptmodule':
return reverse(f'extras:script_result', kwargs={'job_pk': self.pk})
return reverse('core:job', args=[self.pk])
Test Script
import time
from extras.scripts import Script
class Fail(Script):
"""
This job will error if the script deleted before the job is finished
"""
class Meta:
name = "Fail"
job_timeout = 300
def run(self, data, commit):
self.log_info(message="STARTING SCRIPT")
time.sleep(60)
self.log_info(message="SCRIPT ENDED")
return
Expected Behavior
Error handling should be employed in the get_absolute_url method in case object_type does not exist.
Observed Behavior
Error presented when trying to open Jobs page
Metadata
Metadata
Assignees
Labels
severity: lowDoes not significantly disrupt application functionality, or a workaround is availableDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
