Skip to content

Provide the ability to execute custom scripts in response to object changes #11827

Closed as not planned
@jeremystretch

Description

@jeremystretch

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions