From 85caca4dd91ca39f93b140351aba980d7a48ed0d Mon Sep 17 00:00:00 2001 From: Jason Novinger Date: Mon, 31 Aug 2026 19:51:30 -0500 Subject: [PATCH] Fixes #22714: translate the reconcile error and keep helpers out of the public API Wrap the error recorded on a reconciled job in gettext_lazy, since it surfaces in the job detail UI. Drop reconcile_stale_system_jobs() and resolve_job_timeout() from __all__: they are worker-startup internals, not part of the plugin-facing jobs API exported by a wildcard import. rqworker and the tests import them by name. --- netbox/netbox/jobs.py | 5 ++--- netbox/netbox/tests/test_jobs.py | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/netbox/netbox/jobs.py b/netbox/netbox/jobs.py index f0f127ea8..630427d93 100644 --- a/netbox/netbox/jobs.py +++ b/netbox/netbox/jobs.py @@ -9,6 +9,7 @@ from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils import timezone from django.utils.functional import classproperty +from django.utils.translation import gettext_lazy as _ from django_pglocks import advisory_lock from rq.timeouts import JobTimeoutException @@ -22,8 +23,6 @@ from utilities.request import apply_request_processors __all__ = ( 'AsyncViewJob', 'JobRunner', - 'reconcile_stale_system_jobs', - 'resolve_job_timeout', 'system_job', ) @@ -112,7 +111,7 @@ def reconcile_stale_system_jobs(job_class, interval): # system job, terminate() sends no notification and triggers no event rule. job.terminate( status=JobStatusChoices.STATUS_ERRORED, - error="Worker terminated before job completed", + error=_("Worker terminated before job completed"), ) diff --git a/netbox/netbox/tests/test_jobs.py b/netbox/netbox/tests/test_jobs.py index e57799eec..4e58f1dd6 100644 --- a/netbox/netbox/tests/test_jobs.py +++ b/netbox/netbox/tests/test_jobs.py @@ -13,7 +13,12 @@ from utilities.testing import disable_warnings from utilities.testing.mixins import RQQueueTestMixin from ..jobs import * -from ..jobs import _INSTALL_ROOT, STALE_RUNNING_JOB_GRACE_SECONDS +from ..jobs import ( + _INSTALL_ROOT, + STALE_RUNNING_JOB_GRACE_SECONDS, + reconcile_stale_system_jobs, + resolve_job_timeout, +) class TestJobRunner(JobRunner):