[PR #18728] [MERGED] Handle null table in TableConfigForm #15430

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/18728
Author: @bctiemann
Created: 2/25/2025
Status: Merged
Merged: 2/25/2025
Merged by: @jeremystretch

Base: mainHead: 18722-handle-errored-script-in-TableConfigForm


📝 Commits (1)

  • f26f494 Handle null table in TableConfigForm

📊 Changes

1 file changed (+3 additions, -2 deletions)

View changed files

📝 netbox/utilities/forms/forms.py (+3 -2)

📄 Description

Fixes: #18722

This simple defensive fix ensures that table is not null before trying to initialize the fields on it. This handles the case where a custom script fails due to an error, resulting in an AttributeError: 'NoneType' object has no attribute 'available_columns' on the ephemeral job result page (http://127.0.0.1:8000/extras/scripts/results/33/) which only appears after directly running the script via the UI.

Normally NetBox will validate any syntax errors or other issues with a newly uploaded script and prevent it from being runnable. However, if an existing script fails to run due to an emergent systemic issue, the result page will throw the above error because table (which would show log results) is null. With this fix, the table is simply omitted and the "Errored" badge is shown. The specifics of the error can then be seen in the job detail page (http://127.0.0.1:8000/core/jobs/14/).


🔄 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/18728 **Author:** [@bctiemann](https://github.com/bctiemann) **Created:** 2/25/2025 **Status:** ✅ Merged **Merged:** 2/25/2025 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `main` ← **Head:** `18722-handle-errored-script-in-TableConfigForm` --- ### 📝 Commits (1) - [`f26f494`](https://github.com/netbox-community/netbox/commit/f26f4947bc6f34dada199092bd390bee76b2e039) Handle null table in TableConfigForm ### 📊 Changes **1 file changed** (+3 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `netbox/utilities/forms/forms.py` (+3 -2) </details> ### 📄 Description ### Fixes: #18722 This simple defensive fix ensures that `table` is not null before trying to initialize the fields on it. This handles the case where a custom script fails due to an error, resulting in an `AttributeError: 'NoneType' object has no attribute 'available_columns'` on the ephemeral job result page (http://127.0.0.1:8000/extras/scripts/results/33/) which only appears after directly running the script via the UI. Normally NetBox will validate any syntax errors or other issues with a newly uploaded script and prevent it from being runnable. However, if an existing script fails to run due to an emergent systemic issue, the result page will throw the above error because `table` (which would show log results) is null. With this fix, the table is simply omitted and the "Errored" badge is shown. The specifics of the error can then be seen in the job detail page (http://127.0.0.1:8000/core/jobs/14/). --- <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:21:52 +01:00
adam closed this issue 2025-12-30 00:21:53 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15430