diff --git a/netbox/core/tables/tasks.py b/netbox/core/tables/tasks.py index de792d134..90f04a926 100644 --- a/netbox/core/tables/tasks.py +++ b/netbox/core/tables/tasks.py @@ -53,7 +53,7 @@ class BackgroundTaskTable(BaseTable): def render_id(self, value, record): return mark_safe('' + value + '' + args=[value]) + '>' + value + '' ) def render_status(self, value, record): diff --git a/netbox/core/urls.py b/netbox/core/urls.py index c9616a2fd..0c74e1f46 100644 --- a/netbox/core/urls.py +++ b/netbox/core/urls.py @@ -28,7 +28,7 @@ urlpatterns = ( # Background Tasks path('background-queues/', views.BackgroundQueueListView.as_view(), name='background_queue_list'), path('background-queues//', views.BackgroundTaskListView.as_view(), name='background_task_list'), - path('background-tasks///', views.BackgroundTaskDetailView.as_view(), name='background_task'), + path('background-tasks//', views.BackgroundTaskDetailView.as_view(), name='background_task'), # Config revisions path('config-revisions/', views.ConfigRevisionListView.as_view(), name='configrevision_list'), diff --git a/netbox/core/views.py b/netbox/core/views.py index ee0d0a873..5a5344f67 100644 --- a/netbox/core/views.py +++ b/netbox/core/views.py @@ -5,7 +5,8 @@ from django.contrib.auth.mixins import UserPassesTestMixin from django.core.cache import cache from django.http import HttpResponseForbidden, Http404 from django.utils.translation import gettext_lazy as _ -from django_rq.queues import get_queue_by_index +from django_rq.queues import get_queue_by_index, get_redis_connection +from django_rq.settings import QUEUES_MAP, QUEUES_LIST from django_rq.utils import get_scheduler_statistics, get_statistics from django.shortcuts import get_object_or_404, redirect, render from django.views.generic import View @@ -285,14 +286,17 @@ class BackgroundTaskDetailView(UserPassesTestMixin, View): def test_func(self): return self.request.user.is_staff - def get(self, request, queue_index, job_id): - queue = get_queue_by_index(queue_index) - + def get(self, request, job_id): + # all the RQ queues should use the same connection + config = QUEUES_LIST[0] try: - job = RQ_Job.fetch(job_id, connection=queue.connection, serializer=queue.serializer) + job = RQ_Job.fetch(job_id, connection=get_redis_connection(config['connection_config']),) except NoSuchJobError: raise Http404(_("Job {job_id} not found").format(job_id=job_id)) + queue_index = QUEUES_MAP[job.origin] + queue = get_queue_by_index(queue_index) + try: job.func_name data_is_valid = True