[PR #19013] [MERGED] Fixes #18965: Ensure script list run buttons respect scripts' commit_default option #15498

Closed
opened 2025-12-30 00:22:19 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/19013
Author: @jnovinger
Created: 3/26/2025
Status: Merged
Merged: 3/27/2025
Merged by: @jeremystretch

Base: mainHead: 18965-run-script-w-commit-from-script-list


📝 Commits (2)

  • 42289d1 Fixes #18965: Script list run buttons respect scripts' commit_default
  • 62bfb5b Cleanup script .Meta access in template

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 netbox/templates/extras/script_list.html (+4 -1)

📄 Description

Fixes: #18965

For the ScriptListView, we're rendering one-off forms directly in HTML for each of the scripts in a module. Previous to this change, that form consisted only of a hidden CSRF token input and the Run/Run Again button. This meant that that the post handler was interpreting the incoming request.POST as indicating _commit=False, essentially.

This change checks the script's associated python_class.commit_default attribute and conditionally renders a hidden _commit checkbox input for each script's form in ScriptListView so that the post handler will behave accordingly. This has the added benefit of ensuring that the commit default checkbox button is rendered checked or not correctly on the subsequent ScriptView if the RQ worker is not available.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/19013 **Author:** [@jnovinger](https://github.com/jnovinger) **Created:** 3/26/2025 **Status:** ✅ Merged **Merged:** 3/27/2025 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `main` ← **Head:** `18965-run-script-w-commit-from-script-list` --- ### 📝 Commits (2) - [`42289d1`](https://github.com/netbox-community/netbox/commit/42289d103a12d880cb5a3884d1202a74f77f6cb1) Fixes #18965: Script list run buttons respect scripts' commit_default - [`62bfb5b`](https://github.com/netbox-community/netbox/commit/62bfb5b53afb2c4e8830f70872e188780cf2a615) Cleanup script .Meta access in template ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `netbox/templates/extras/script_list.html` (+4 -1) </details> ### 📄 Description <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be approved and assigned prior to opening a pull request. This helps avoid waste time and effort on a proposed change that we might not be able to accept. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED TO YOU, IT WILL BE CLOSED AUTOMATICALLY. Please specify your assigned issue number on the line below. --> ### Fixes: #18965 For the ScriptListView, we're rendering one-off forms directly in HTML for each of the scripts in a module. Previous to this change, that form consisted only of a hidden CSRF token input and the Run/Run Again button. This meant that that the post handler was interpreting the incoming `request.POST` as indicating `_commit=False`, essentially. This change checks the script's associated `python_class.commit_default` attribute and conditionally renders a hidden `_commit` checkbox input for each script's form in ScriptListView so that the post handler will behave accordingly. This has the added benefit of ensuring that the commit default checkbox button is rendered checked or not correctly on the subsequent ScriptView if the RQ worker is not available. <!-- Please include a summary of the proposed changes below. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:22:19 +01:00
adam closed this issue 2025-12-30 00:22:19 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15498