|
1 |
| -# NetBox Script Manager Plugin |
| 1 | +# NetBox Script Manager |
2 | 2 |
|
3 |
| -Improved custom script support for netbox |
4 |
| - |
5 |
| - |
6 |
| -* Free software: MIT |
7 |
| -* Documentation: https://kkthxbye-code.github.io/netbox-plugin-script-manager/ |
| 3 | +Improved custom script support for netbox. Netbox version 3.5 removed several features related to custom scripts. This plugin attempts to undo these changes and add other improvements to scripts in netbox. |
8 | 4 |
|
| 5 | +The plugin can be used in addition to the built-in script support and does not disable any netbox features. |
9 | 6 |
|
10 | 7 | ## Features
|
11 | 8 |
|
12 |
| -The features the plugin provides should be listed here. |
| 9 | +* Scripts can be stored in nested modules. |
| 10 | +* Scripts can rely on non-script module files. |
| 11 | +* Scripts are loaded from a file-system folder. |
| 12 | +* It's possible to sync scripts by pulling any git repo located in the `SCRIPT_ROOT` (WIP) |
| 13 | +* Name, group, description, task queues, comments and tags are editable in the UI. |
| 14 | +* Task queue is selectable in the UI. |
| 15 | +* Exceptions caused by errors in script files are displayed in the UI. |
| 16 | +* Log messages are saved and displayed when the script is running allowing live output for long running scripts. |
| 17 | +* It's possible to filter log lines by message and/or log level. |
| 18 | +* Script executions are listed in a tab when viewing a script. |
| 19 | +* Changelog entries are listed in a tab when viewing a finished script execution. |
| 20 | +* It's possible to save script artifacts during the execution of a script. These artifacts will show up as downloadable files. |
| 21 | +* Possibility to re-run scripts. |
| 22 | + |
| 23 | +## What is not supported |
| 24 | + |
| 25 | +* Reports |
| 26 | +* DataSource/DataFile |
| 27 | +* `load_json` and `load_yaml` convenience methods |
| 28 | +* `script_order` - the ordering of scripts is instead based on `group` and `weight` |
13 | 29 |
|
14 | 30 | ## Compatibility
|
15 | 31 |
|
16 | 32 | | NetBox Version | Plugin Version |
|
17 | 33 | |----------------|----------------|
|
18 |
| -| 3.4 | 0.1.0 | |
| 34 | +| 3.5 | 0.1.0 | |
19 | 35 |
|
20 |
| -## Installing |
| 36 | +## Script folder |
21 | 37 |
|
22 |
| -For adding to a NetBox Docker setup see |
23 |
| -[the general instructions for using netbox-docker with plugins](https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins). |
| 38 | +The loading of scripts is a little different with netbox-script-manager. The `SCRIPT_ROOT` plugin setting must be set to define the path of the custom scripts, however the scripts must be located in a folder named `customscripts` in this path. |
24 | 39 |
|
25 |
| -While this is still in development and not yet on pypi you can install with pip: |
| 40 | +A folder structure like this is required (`SCRIPT_ROOT` pointing to the `netboxscripts` folder): |
26 | 41 |
|
27 | 42 | ```bash
|
28 |
| -pip install git+https://github.com/kkthxbye-code/netbox_script_manager |
| 43 | +├── netboxscripts |
| 44 | +│ ├── customscripts |
| 45 | +│ │ ├── __init__.py |
| 46 | +│ │ ├── nestedmodule |
| 47 | +│ │ ├── root_script.py |
| 48 | +│ │ └── util |
| 49 | +│ └── __init__.py |
29 | 50 | ```
|
30 | 51 |
|
31 |
| -or by adding to your `local_requirements.txt` or `plugin_requirements.txt` (netbox-docker): |
| 52 | +The reason for requiring this layout with a `customscripts` folder is to avoid name collisions when dynamically loading scripts. It also makes it easier to clear the internal python module cache which is needed for reloading scripts. |
32 | 53 |
|
33 |
| -```bash |
34 |
| -git+https://github.com/kkthxbye-code/netbox_script_manager |
| 54 | +## Installing |
| 55 | + |
| 56 | +Add the plugin to `local_requirements.txt` or `plugin_requirements.txt` (netbox-docker): |
| 57 | + |
| 58 | +``` |
| 59 | +netbox-script-manager |
35 | 60 | ```
|
36 | 61 |
|
37 | 62 | Enable the plugin in `/opt/netbox/netbox/netbox/configuration.py`,
|
38 |
| - or if you use netbox-docker, your `/configuration/plugins.py` file : |
| 63 | + or if you use netbox-docker, your `/configuration/plugins.py` file: |
39 | 64 |
|
40 | 65 | ```python
|
41 | 66 | PLUGINS = [
|
42 |
| - 'Script Manager' |
| 67 | + 'netbox_script_manager' |
43 | 68 | ]
|
44 | 69 |
|
45 | 70 | PLUGINS_CONFIG = {
|
46 |
| - "Script Manager": {}, |
| 71 | + "netbox_script_manager Manager": { |
| 72 | + "SCRIPT_ROOT": "/path/to/script/folder/", |
| 73 | + "DEFAULT_QUEUE": "high" |
| 74 | + }, |
47 | 75 | }
|
48 | 76 | ```
|
0 commit comments