Script Rest API has no results #8329

Closed
opened 2025-12-29 20:35:25 +01:00 by adam · 0 comments
Owner

Originally created by @jiuka on GitHub (Jul 12, 2023).

Originally assigned to: @kkthxbye-code on GitHub.

NetBox version

v3.5.6

Python version

3.11

Steps to Reproduce

As reported in #13061 not only the UI had this issue but the Rest API too.

  1. Save this script into a file called bug.py
from extras.scripts import *


class Bug13061(Script):

    class Meta:
        name = "Demo for Bug13061"
        description = "Demo for Bug13061"

    def run(self, data, commit):
        self.log_success(f"Demo for Bug13061")
  1. Go to https://netbox.example.com/extras/scripts/add/
  2. Upload the bug.py file.
  3. Got to https://netbox.example.com/extras/scripts/bug/Bug13061/
  4. Click on Run Script
  5. Go to https://netbox.example.com/api/extras/scripts/bug.Bug13061/

Expected Behavior

The result should be job result like in the reports endpoint.

Observed Behavior

It is always null.

The job.name is just the name of the script class. When search for the result the script.name
is used and not the class_name therefore no results are found, unless the name ist set to the same value as the class_name.

Originally created by @jiuka on GitHub (Jul 12, 2023). Originally assigned to: @kkthxbye-code on GitHub. ### NetBox version v3.5.6 ### Python version 3.11 ### Steps to Reproduce As reported in #13061 not only the UI had this issue but the Rest API too. 1. Save this script into a file called bug.py ``` from extras.scripts import * class Bug13061(Script): class Meta: name = "Demo for Bug13061" description = "Demo for Bug13061" def run(self, data, commit): self.log_success(f"Demo for Bug13061") ``` 2. Go to https://netbox.example.com/extras/scripts/add/ 3. Upload the bug.py file. 4. Got to https://netbox.example.com/extras/scripts/bug/Bug13061/ 5. Click on Run Script 6. Go to https://netbox.example.com/api/extras/scripts/bug.Bug13061/ ### Expected Behavior The `result` should be job result like in the reports endpoint. ### Observed Behavior It is always `null`. The [job.name](https://github.com/netbox-community/netbox/blob/develop/netbox/extras/api/views.py#L293C13-L293C21) is just the name of the script class. When search for the result the [script.name](https://github.com/netbox-community/netbox/blob/develop/netbox/extras/api/views.py#L306C41-L306C52) is used and not the `class_name` therefore no results are found, unless the `name` ist set to the same value as the `class_name`.
adam added the type: bugstatus: acceptedseverity: medium labels 2025-12-29 20:35:25 +01:00
adam closed this issue 2025-12-29 20:35:25 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8329