Script Results Showing Logs as JSON #9934

Closed
opened 2025-12-29 21:24:40 +01:00 by adam · 4 comments
Owner

Originally created by @jchambers2012 on GitHub (Jul 2, 2024).

Deployment Type

Self-hosted

NetBox Version

4.0.5

Python Version

3.10

Steps to Reproduce

Scripts Page

  1. Update load the following script called Log Test
from extras.scripts import *
class testScript(Script):
    class Meta:
        name = "Log Test"
        scheduling_enabled = False
        description = ""
    def run(self, data, commit):
        for i in range(6):
            self.log_info(f"Log Test - Sleeping for 1 Sec - {i}")
        return str("")
  1. Run the script – The script will render with each log will be shown as html via the /extras/scripts/results/<int:pk>/ URL

  2. Go back the Script View (/extras/scripts/)

  3. Click on the job “Log Test”

  4. Click on the Jobs tab
    image

  5. Click on the ID of the job and the script goes to a URL of /core/jobs/<int:pk>/

  6. Script is showing logs as a JSON Object

Expected Behavior

The URL of /extras/scripts/results/<int:pk>/ should be called

Observed Behavior

Scripts are using the default job template that is dumping the logs as a JSON object

image

Originally created by @jchambers2012 on GitHub (Jul 2, 2024). ### Deployment Type Self-hosted ### NetBox Version 4.0.5 ### Python Version 3.10 ### Steps to Reproduce ## Scripts Page 1. Update load the following script called Log Test ```python from extras.scripts import * class testScript(Script): class Meta: name = "Log Test" scheduling_enabled = False description = "" def run(self, data, commit): for i in range(6): self.log_info(f"Log Test - Sleeping for 1 Sec - {i}") return str("") ``` 2. Run the script – The script will render with each log will be shown as html via the `/extras/scripts/results/<int:pk>/` URL 3. Go back the Script View (`/extras/scripts/`) 4. Click on the job “Log Test” 5. Click on the Jobs tab ![image](https://github.com/netbox-community/netbox/assets/6090690/7cc2aa49-2f9d-4dbc-9f50-83109a7553c8) 7. Click on the ID of the job and the script goes to a URL of `/core/jobs/<int:pk>/` 8. Script is showing logs as a JSON Object ### Expected Behavior The URL of `/extras/scripts/results/<int:pk>/` should be called ### Observed Behavior Scripts are using the default job template that is dumping the logs as a JSON object ![image](https://github.com/netbox-community/netbox/assets/6090690/1c384f5f-fb2f-480a-9d18-7d626c9fd239)
adam closed this issue 2025-12-29 21:24:40 +01:00
Author
Owner

@jchambers2012 commented on GitHub (Jul 2, 2024):

Maybe related #16785

@jchambers2012 commented on GitHub (Jul 2, 2024): Maybe related #16785
Author
Owner

@alehaa commented on GitHub (Jul 2, 2024):

Yep, its the same problem and I also overlooked there is already a feature request for this: #15983

@alehaa commented on GitHub (Jul 2, 2024): Yep, its the same problem and I also overlooked there is already a feature request for this: #15983
Author
Owner

@jchambers2012 commented on GitHub (Jul 2, 2024):

This one might be able to be fixed by updating the table's URL it links too as this is still under the /extras/scripts/##/jobs/ URLs - but if the links cant be updated then #15983 would be the parent.

@jchambers2012 commented on GitHub (Jul 2, 2024): This one might be able to be fixed by updating the table's URL it links too as this is still under the `/extras/scripts/##/jobs/` URLs - but if the links cant be updated then #15983 would be the parent.
Author
Owner

@alehaa commented on GitHub (Jul 2, 2024):

Fixing the link was rejected in my PR. Please see the maintainers last comment, I think the desired behavior is reasonable.

@alehaa commented on GitHub (Jul 2, 2024): Fixing the link was rejected in my PR. Please see the maintainers last comment, I think the desired behavior is reasonable.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9934