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

Fixes: #17648 - Fix exception thrown in Job.delete() when no object_type specified #17657

Merged
merged 4 commits into from
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions netbox/core/models/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
from core.choices import JobStatusChoices
from core.models import ObjectType
from core.signals import job_end, job_start
from netbox.config import get_config
from netbox.constants import RQ_QUEUE_DEFAULT
from utilities.querysets import RestrictedQuerySet
from utilities.rqworker import get_queue_for_model

Expand Down Expand Up @@ -154,7 +152,7 @@ def duration(self):
def delete(self, *args, **kwargs):
super().delete(*args, **kwargs)

rq_queue_name = get_config().QUEUE_MAPPINGS.get(self.object_type.model, RQ_QUEUE_DEFAULT)
rq_queue_name = get_queue_for_model(self.object_type.model if self.object_type else None)
queue = django_rq.get_queue(rq_queue_name)
job = queue.fetch_job(str(self.job_id))

Expand Down