netbox
netbox copied to clipboard
Maintain database representations of reports & scripts
NetBox version
v3.6.6
Feature type
Data model extension
Proposed functionality
Promote the "dummy" models in the extras
that currently represent reports and scripts to "real" models corresponding to database tables. Each Report or Script instance will correlate to a Python class belonging to a ReportModule or ScriptModule, respectively. Report and Script objects will be created, updated, and deleted automatically in response to content changes in their assigned module.
Use case
The lack of a concrete database object representing individual reports and scripts limits our ability to efficiently represent relationships with other NetBox objects. Two prime examples are:
- Bug #14382 - It is not currently possible to associate a specific report or script with a Webhook
- FR #14132 (v3.7) - Specifying a report or script as the action of an EventRule requires us to store the report/script class name in addition to the ForeignKey relationship to the parent module
Essentially, we reduce the current need for a tuple of (module, class) to a simple ForeignKey relationship.
Database changes
Promoting the Report and Script classes to concrete models will effect the creation of two new PostgreSQL tables:
-
extras_report
-
extras_script
One new database record will be automatically created for each report and script currently installed.
External dependencies
None
Will this allow scripts to be persistent through replacement? It would be nice not to have to delete them each time a script is updated, although I understand how that could create issues if allowed unchecked.