Closed kollross closed 4 weeks ago
@kollross Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v4.0.2. "that script is missing the button." I don't know what that script is - the existing scripts I have on my installation still have the Run Script button. Can you please check what is different about the script then your other scripts, generally a run script button missing would indicate that there is an issue with the script code.
I believe I have the same issue.
What is worse is there is no way to delete the script now
@bitcollector1 "What is worse is there is no way to delete the script now" please file a separate issue if you are running into this and can reproduce.
Note: There is a PR #15441 that adds better script error reporting (to show errors in the script code) - I'm guessing (without a repo scenario) that the scripts without the run button has an error, that PR would make it easier to find.
I was able to delete my script that had issues by going into the shell and deleting the event rule that was causing the issue deleting the problematic script
>>> EventRule.objects.all()
<RestrictedQuerySet [<EventRule: IP Updated>]>
>>> EventRule.objects.all().delete()
(2, {'extras.EventRule_object_types': 1, 'extras.EventRule': 1})
>>>
>>> EventRule.objects.all().delete()
(0, {})
I can see my script now, it was in fact related to an error in the code that was preventing it from loading correctly.
Thanks you @arthanson very much for helping me see and fix my issue. This can get very tricky, with all the dependencies and changes going on :)
During the upgrade to 4.0.2 one of the required pip modules wasn't installed. But because I couldn't run the script from the GUI, there was no viable output to tell me it had a missing module. Deleting the script, and re-adding it produced a buttonless section of the script. Tailing the logs when deleting and re-adding the script also produced no errors. The only way I was able to troubleshoot to was to drop into /opt/netbox/venv/bin/python and running the script line by line to see where the erroring out.
Thank goodness for "https://github.com/netbox-community/netbox/discussions/12813" otherwise this sort of thing would also impossible to troubleshoot.
Deployment Type
Self-hosted
NetBox Version
v4.0.2
Python Version
3.10
Steps to Reproduce
This script was working yesterday, I upgraded to 4.0.2 today and now that script is missing the button. Other scripts still have the "Run Script" option.
Expected Behavior
"Run Script" button be present and clickable.
Observed Behavior
emptyness