Job results are not available when executing custom scripts via the runscript command #8981

Closed
opened 2025-12-29 20:43:47 +01:00 by adam · 2 comments
Owner

Originally created by @erikastr on GitHub (Dec 18, 2023).

Originally assigned to: @kprince28 on GitHub.

Deployment Type

Self-hosted

NetBox Version

v3.6.6

Python Version

3.11

Steps to Reproduce

  1. Create/upload any custom script (e.g. the example script from documentation)
  2. Try to execute the script via runscript command
/opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py runscript example.NewBranchScript --commit --loglevel debug --data '{"site_name": "testing", "switch_count": 1, "switch_model": 11}'

Expected Behavior

Script is completed and job results are available

Observed Behavior

Script gets completed, but a KeyError exception gets raised when trying to access the job results
image

It seems that an incorrect name tries to get accessed when the script is ran through the runscript command, as compared to running the script via the GUI

image
Originally created by @erikastr on GitHub (Dec 18, 2023). Originally assigned to: @kprince28 on GitHub. ### Deployment Type Self-hosted ### NetBox Version v3.6.6 ### Python Version 3.11 ### Steps to Reproduce 1. Create/upload any custom script (e.g. the example script from documentation) 2. Try to execute the script via `runscript` command ``` /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py runscript example.NewBranchScript --commit --loglevel debug --data '{"site_name": "testing", "switch_count": 1, "switch_model": 11}' ``` ### Expected Behavior Script is completed and job results are available ### Observed Behavior Script gets completed, but a KeyError exception gets raised when trying to access the job results <img width="564" alt="image" src="https://github.com/netbox-community/netbox/assets/87935328/52557547-6fc4-41d0-98f5-83fa8909ce5b"> It seems that an incorrect name tries to get accessed when the script is ran through the `runscript` command, as compared to running the script via the GUI <img width="1169" alt="image" src="https://github.com/netbox-community/netbox/assets/87935328/1bd7a06d-4a5a-4899-ade3-1ca7ada8277f">
adam added the type: bugstatus: acceptedseverity: medium labels 2025-12-29 20:43:47 +01:00
adam closed this issue 2025-12-29 20:43:47 +01:00
Author
Owner

@jeffgdotorg commented on GitHub (Dec 20, 2023):

Thanks for your report. The team will get to work on it as capacity allows.

@jeffgdotorg commented on GitHub (Dec 20, 2023): Thanks for your report. The team will get to work on it as capacity allows.
Author
Owner

@kprince28 commented on GitHub (Dec 20, 2023):

Can anyone please assign this to me ?

@kprince28 commented on GitHub (Dec 20, 2023): Can anyone please assign this to me ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8981