`script_order` is not respected in the Scripts list

Open
#205 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Start with the two steps the report names: where script_order is read during discovery, and where a revision is activated and the published Script is saved. Check whether the position is stored on the Script record, then whether the Scripts list sorts by project, module path and class name instead of that stored position. Reproduce by uploading the Zulu/Alpha example and confirming the list order. Done when Zulu appears before Alpha in the default list and the order survives activation.

Written by the indexing model from the issue text.

Description

app: scripts Bucket: KTLO severity: low status: backlog type: bug
Plugin Version

v0.1.0

NetBox Version

v4.7.5

Python Version

3.12

Steps to Reproduce
  1. Upload a Script File containing the following code:
    from netbox_scripts import Script
    
    
    class Zulu(Script):
        def run(self, data, commit):
            pass
    
    
    class Alpha(Script):
        def run(self, data, commit):
            pass
    
    
    script_order = [Zulu, Alpha]
    
  2. Validate and activate the revision.
  3. Open the Scripts list and filter by the Project, using the default sorting.
Expected Behavior

Zulu appears before Alpha, respecting the order defined in script_order, as documented in the authoring guide and supported by NetBox's built-in Custom Scripts functionality.

Observed Behavior

Alpha appears before Zulu. The Scripts list defaults to ordering by Project, module path and class name, ignoring the author-defined presentation order.

Discovery records the intended position, but activation does not persist it on the published Script.

This also affects the ordering intended for the grouped Scripts view proposed in #81.

Dominant language
Python
Stars
9
Forks
0
Avg merge
18h 59m
Merged PRs (30d)
93

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from netbox-community/netbox-scripts

All issues in netbox-community/netbox-scripts

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.