Multipart runs ignore the Script's default when commit is omitted

Open Beginner friendly
#74 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

Research direction

Start at the REST API script run entry point and trace how multipart form data is converted into the Script's run parameters, comparing it with the JSON request path. Reproduce with the provided CommitProbe script and a multipart request that omits commit. Done means the multipart run uses the Script's enabled default and keeps the created tag; check the Job log and Tags list.

Written by the indexing model from the issue text.

Description

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

v0.0.1

NetBox Version

v4.7.3

Python Version

3.12

Steps to Reproduce
  1. Upload and activate the following commit_probe.py. Leave the Script's commit override unset, and ensure no tag with the slug multipart-commit-probe exists.
    from extras.models import Tag
    from netbox_scripts.scripts import Script
    
    
    class CommitProbe(Script):
        def run(self, data, commit):
            Tag.objects.create(
                name='Multipart commit probe',
                slug='multipart-commit-probe',
            )
    
  2. Request a multipart run without commit, replacing 12 with the Script's ID:
    curl -sS -X POST \
      -H "Authorization: Token $NETBOX_TOKEN" \
      -F 'data={}' \
      https://netbox.example.com/api/plugins/netbox-scripts/scripts/12/run/
    
  3. Wait for the returned Job to finish, then check its log and the Tags list.
Expected Behavior

The run uses the Script's effective commit default, which is enabled, and keeps the new tag. The execution guide documents this behavior when commit is omitted.

Observed Behavior

The Job records commit as false and completes as a dry run. The tag is absent, and the log contains:

Database changes have been reverted, this was a dry run.

The equivalent JSON request follows the Script's default. Adding -F 'commit=true' to the multipart request also keeps the tag.

This is separate from #16, which covers the multipart request schema.

Dominant language
Python
Stars
8
Forks
0
Avg merge
11h 23m
Merged PRs (30d)
24

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.