Provide the ability to execute custom scripts in response to object changes #11827
Labels
status: accepted
This issue has been accepted for implementation
type: feature
Introduction of new functionality to the application
NetBox version
v3.4.5
Feature type
New functionality
Proposed functionality
Establish a mechanism by which a custom script can "attach" to one or more signals, so that the script automatically runs when the signal is received. This will likely need to be done programmatically as scripts are discovered. It should be possible to associate a script with a particular arbitrary signal and optionally only to certain senders for that signal.
We'll need to devise a way to automatically discover scripts, as scripts are currently only loaded as needed (e.g. in response to UI/API requests). Special consideration must also be paid to the execution workflow, to ensure that a catastrophic script error does not interfere with the triggering behavior.
For registration, it may be sufficient to call
get_scripts()
upon NetBox initialization, and execute a prescribed class method on each discovered script to handle its signal attachment. We'll also need to devise a convention for declaring receiver methods on each script.Use case
Often it is desirable to automatically execute a custom script in response to the creation, modification, or deletion of a NetBox object (similar to how webhooks function).
Database changes
No response
External dependencies
No response
The text was updated successfully, but these errors were encountered: