Skip to content

Conversation

@bctiemann
Copy link
Contributor

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/).

@jeremystretch jeremystretch merged commit 3b894f9 into main Feb 25, 2025
6 checks passed
@jeremystretch jeremystretch deleted the 18722-handle-errored-script-in-TableConfigForm branch February 25, 2025 17:59
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom scripts failures

4 participants