Jobs page not loading #10277

Closed
opened 2025-12-29 21:29:18 +01:00 by adam · 3 comments
Owner

Originally created by @wz4 on GitHub (Sep 22, 2024).

Originally assigned to: @DanSheps on GitHub.

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

Screenshot from 2024-09-22 09-14-30

Originally created by @wz4 on GitHub (Sep 22, 2024). Originally assigned to: @DanSheps on GitHub. ### 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()](https://github.com/netbox-community/netbox/blob/develop/netbox/core/models/jobs.py#L119) 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 ![Screenshot from 2024-09-22 09-14-30](https://github.com/user-attachments/assets/decb2095-943f-4d9b-a872-b7c530f90c3f)
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:29:18 +01:00
adam closed this issue 2025-12-29 21:29:18 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 23, 2024):

Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

@jeremystretch commented on GitHub (Sep 23, 2024): Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.
Author
Owner

@wz4 commented on GitHub (Sep 25, 2024):

Revisions were made, can you please review. @jeremystretch

@wz4 commented on GitHub (Sep 25, 2024): Revisions were made, can you please review. @jeremystretch
Author
Owner

@github-actions[bot] commented on GitHub (Oct 2, 2024):

This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically.

@github-actions[bot] commented on GitHub (Oct 2, 2024): This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10277