mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00

* Fix check for existing jobs If a job is to be enqueued once and no specific scheduled time is specified, any scheduled time of existing jobs will be valid. Only if a specific scheduled time is specified for 'enqueue_once()' can it be evaluated. * Allow system jobs to be registered A new registry key allows background system jobs to be registered and automatically scheduled when rqworker starts. * Test scheduling of system jobs * Fix plugins scheduled job documentation The documentation reflected a non-production state of the JobRunner framework left over from development. Now a more practical example demonstrates the usage. * Allow plugins to register system jobs * Rename system job metadata To clarify which meta-attributes belong to system jobs, each of them is now prefixed with 'system_'. * Add predefined job interval choices * Remove 'system_enabled' JobRunner attribute Previously, the 'system_enabled' attribute was used to control whether a job should run or not. However, this can also be accomplished by evaluating the job's interval. * Fix test * Use a decorator to register system jobs * Specify interval when registering system job * Update documentation --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
24 lines
864 B
Markdown
24 lines
864 B
Markdown
# Data Backends
|
|
|
|
[Data sources](../../models/core/datasource.md) can be defined to reference data which exists on systems of record outside NetBox, such as a git repository or Amazon S3 bucket. Plugins can register their own backend classes to introduce support for additional resource types. This is done by subclassing NetBox's `DataBackend` class.
|
|
|
|
```python title="data_backends.py"
|
|
from netbox.data_backends import DataBackend
|
|
|
|
class MyDataBackend(DataBackend):
|
|
name = 'mybackend'
|
|
label = 'My Backend'
|
|
...
|
|
```
|
|
|
|
To register one or more data backends with NetBox, define a list named `backends` at the end of this file:
|
|
|
|
```python title="data_backends.py"
|
|
backends = [MyDataBackend]
|
|
```
|
|
|
|
!!! tip
|
|
The path to the list of data backends can be modified by setting `data_backends` in the PluginConfig instance.
|
|
|
|
::: netbox.data_backends.DataBackend
|