Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jobs page not loading #17566

Closed
wz4 opened this issue Sep 22, 2024 · 3 comments · Fixed by #17661
Closed

Jobs page not loading #17566

wz4 opened this issue Sep 22, 2024 · 3 comments · Fixed by #17661
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@wz4
Copy link

wz4 commented Sep 22, 2024

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

@wz4 wz4 added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Sep 22, 2024
@jeremystretch
Copy link
Member

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 jeremystretch added status: revisions needed This issue requires additional information to be actionable and removed status: needs triage This issue is awaiting triage by a maintainer labels Sep 23, 2024
@wz4
Copy link
Author

wz4 commented Sep 24, 2024

Revisions were made, can you please review. @jeremystretch

Copy link
Contributor

github-actions bot commented 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 github-actions bot added the pending closure Requires immediate attention to avoid being closed for inactivity label Oct 2, 2024
@DanSheps DanSheps added status: accepted This issue has been accepted for implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: revisions needed This issue requires additional information to be actionable pending closure Requires immediate attention to avoid being closed for inactivity labels Oct 2, 2024
@DanSheps DanSheps self-assigned this Oct 2, 2024
DanSheps added a commit that referenced this issue Oct 2, 2024
…on being thrown if no object_type is set
bctiemann pushed a commit that referenced this issue Oct 11, 2024
…on being thrown if no object_type is set (#17661)

* Fixes: #17566 - Fix issue `Job.get_absolute_url()` to prevent exception being thrown if no object_type is set

* Add back whitespace after statements

* Remove whitespace.  Change to if statement
bctiemann pushed a commit that referenced this issue Oct 11, 2024
jeremystretch pushed a commit to alehaa/netbox that referenced this issue Oct 11, 2024
… prevent exception being thrown if no object_type is set (netbox-community#17661)

* Fixes: netbox-community#17566 - Fix issue `Job.get_absolute_url()` to prevent exception being thrown if no object_type is set

* Add back whitespace after statements

* Remove whitespace.  Change to if statement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
3 participants