Skip to content

Commit 5e56373

Browse files
committed
Revert "Fixes #12463: Fix the association of completed jobs with reports & scripts in the REST API"
This reverts commit a29a07e.
1 parent 6d70f33 commit 5e56373

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

docs/release-notes/version-3.5.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
* [#12415](https://github.com/netbox-community/netbox/issues/12415) - Fix `ImportError` exception when running RQ worker
3535
* [#12433](https://github.com/netbox-community/netbox/issues/12433) - Correct the application of URL query parameters for object list dashboard widgets
3636
* [#12436](https://github.com/netbox-community/netbox/issues/12436) - Remove extraneous "add" button from contact assignments list
37-
* [#12463](https://github.com/netbox-community/netbox/issues/12463) - Fix the association of completed jobs with reports & scripts in the REST API
3837
* [#12464](https://github.com/netbox-community/netbox/issues/12464) - Apply credentials for git data source only when connecting via HTTP/S
3938
* [#12476](https://github.com/netbox-community/netbox/issues/12476) - Fix `TypeError` exception when running the `runscript` management command
4039
* [#12483](https://github.com/netbox-community/netbox/issues/12483) - Fix git remote data syncing when with HTTP proxies defined

netbox/extras/api/views.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,11 @@ def list(self, request):
187187
"""
188188
Compile all reports and their related results (if any). Result data is deferred in the list view.
189189
"""
190+
report_content_type = ContentType.objects.get(app_label='extras', model='report')
190191
results = {
191-
job.name: job
192-
for job in Job.objects.filter(
193-
object_type=ContentType.objects.get(app_label='extras', model='reportmodule'),
192+
r.name: r
193+
for r in Job.objects.filter(
194+
object_type=report_content_type,
194195
status__in=JobStatusChoices.TERMINAL_STATE_CHOICES
195196
).order_by('name', '-created').distinct('name').defer('data')
196197
}
@@ -201,7 +202,7 @@ def list(self, request):
201202

202203
# Attach Job objects to each report (if any)
203204
for report in report_list:
204-
report.result = results.get(report.name, None)
205+
report.result = results.get(report.full_name, None)
205206

206207
serializer = serializers.ReportSerializer(report_list, many=True, context={
207208
'request': request,
@@ -289,10 +290,12 @@ def _get_script(self, pk):
289290
return module, script
290291

291292
def list(self, request):
293+
294+
script_content_type = ContentType.objects.get(app_label='extras', model='script')
292295
results = {
293-
job.name: job
294-
for job in Job.objects.filter(
295-
object_type=ContentType.objects.get(app_label='extras', model='scriptmodule'),
296+
r.name: r
297+
for r in Job.objects.filter(
298+
object_type=script_content_type,
296299
status__in=JobStatusChoices.TERMINAL_STATE_CHOICES
297300
).order_by('name', '-created').distinct('name').defer('data')
298301
}
@@ -303,7 +306,7 @@ def list(self, request):
303306

304307
# Attach Job objects to each script (if any)
305308
for script in script_list:
306-
script.result = results.get(script.name, None)
309+
script.result = results.get(script.full_name, None)
307310

308311
serializer = serializers.ScriptSerializer(script_list, many=True, context={'request': request})
309312

0 commit comments

Comments
 (0)