netbox-docker-plugin 3.0.1__tar.gz → 3.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {netbox_docker_plugin-3.0.1/netbox_docker_plugin.egg-info → netbox_docker_plugin-3.3.0}/PKG-INFO +13 -3
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/README.md +10 -1
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/__init__.py +1 -1
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/api/serializers.py +38 -1
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/filtersets.py +38 -3
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/container.py +26 -2
- netbox_docker_plugin-3.3.0/netbox_docker_plugin/forms/log_driver_option.py +28 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/volume.py +5 -1
- netbox_docker_plugin-3.3.0/netbox_docker_plugin/migrations/0031_container_cap_add.py +37 -0
- netbox_docker_plugin-3.3.0/netbox_docker_plugin/migrations/0032_device_and_more.py +99 -0
- netbox_docker_plugin-3.3.0/netbox_docker_plugin/migrations/0033_host_operation.py +26 -0
- netbox_docker_plugin-3.3.0/netbox_docker_plugin/migrations/0034_volume_max_size.py +24 -0
- netbox_docker_plugin-3.0.1/netbox_docker_plugin/migrations/0032_device_and_more.py → netbox_docker_plugin-3.3.0/netbox_docker_plugin/migrations/0035_container_log_driver_logdriveroption.py +23 -18
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/models/container.py +57 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/models/volume.py +5 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tables.py +37 -2
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/templates/netbox_docker_plugin/container.html +18 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/templates/netbox_docker_plugin/volume.html +10 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/container/test_container_api.py +8 -1
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/container/test_container_views.py +5 -3
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/volume/test_volume_api.py +1 -1
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/urls.py +22 -0
- netbox_docker_plugin-3.3.0/netbox_docker_plugin/views/log_driver_option.py +27 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0/netbox_docker_plugin.egg-info}/PKG-INFO +13 -3
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin.egg-info/SOURCES.txt +4 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/pyproject.toml +1 -1
- netbox_docker_plugin-3.0.1/netbox_docker_plugin/migrations/0031_container_cap_add.py +0 -29
- netbox_docker_plugin-3.0.1/netbox_docker_plugin/migrations/0033_host_operation.py +0 -20
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/LICENSE +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/MANIFEST.in +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/api/__init__.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/api/renderers.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/api/urls.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/api/views.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/__init__.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/bind.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/device.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/env.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/host.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/image.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/label.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/mount.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/network.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/network_setting.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/port.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/registry.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0001_initial.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0002_image.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0003_image_size.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0004_volume.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0005_network.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0006_container_port_mount_label_env_and_more.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0007_remove_container_netbox_docker_plugin_container_unique_name_host__and_more.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0008_alter_network_unique_together_network_networkid_and_more.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0009_remove_container_network_networksettings_and_more.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0010_container_containerid_and_more.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0011_host_token.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0012_host_state.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0013_host_netbox_url.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0014_container_operation.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0015_remove_mount_netbox_docker_plugin_mount_unique_volume_and_more.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0016_alter_env_value.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0017_network_state.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0018_alter_mount_volume_alter_networksetting_network.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0019_host_agent_version_host_docker_api_version.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0020_container_hostname.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0021_registry_and_more.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0022_bind_bind_netbox_docker_plugin_bind_unique_bind.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0023_delete_hosts.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0024_registry_host_alter_registry_name_and_more.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0025_alter_image_version.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0026_image_digest.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0027_container_restart_policy.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0028_mount_and_bind_read_only.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0029_alter_container_state.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/0030_alter_container_containerid_alter_container_hostname_and_more.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/migrations/__init__.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/models/__init__.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/models/host.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/models/image.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/models/network.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/models/registry.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/navigation.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/signals.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/templates/netbox_docker_plugin/container-exec.html +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/templates/netbox_docker_plugin/container-layout.html +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/templates/netbox_docker_plugin/container-logs.html +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/templates/netbox_docker_plugin/host-graph.html +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/templates/netbox_docker_plugin/host.html +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/templates/netbox_docker_plugin/image.html +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/templates/netbox_docker_plugin/network.html +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/templates/netbox_docker_plugin/registry.html +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/templatetags/__init__.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/templatetags/host.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/__init__.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/base.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/container/__init__.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/container/test_container_actions.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/container/test_container_api_exec.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/container/test_container_operation_view.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/container/test_container_validation.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/host/__init__.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/host/test_host_api.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/host/test_host_views.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/host/test_replace_password.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/image/__init__.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/image/test_image_api.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/image/test_image_views.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/network/__init__.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/network/test_network_api.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/network/test_network_views.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/registry/__init__.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/registry/test_registry_api.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/registry/test_registry_views.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/test_init.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/volume/__init__.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/tests/volume/test_volume_views.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/utilities/__init__.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/views/__init__.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/views/bind.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/views/container.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/views/device.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/views/env.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/views/host.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/views/image.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/views/label.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/views/mount.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/views/network.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/views/network_setting.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/views/port.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/views/registry.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/views/volume.py +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin.egg-info/dependency_links.txt +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin.egg-info/top_level.txt +0 -0
- {netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/setup.cfg +0 -0
{netbox_docker_plugin-3.0.1/netbox_docker_plugin.egg-info → netbox_docker_plugin-3.3.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: netbox-docker-plugin
|
|
3
|
-
Version: 3.0
|
|
3
|
+
Version: 3.3.0
|
|
4
4
|
Summary: Manage Docker with Netbox & style.
|
|
5
5
|
Author-email: Vincent Simonin <vincent@saashup.com>, David Delassus <david.jose.delassus@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/SaaShup/netbox-docker-plugin
|
|
@@ -10,6 +10,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
10
10
|
Requires-Python: >=3.11
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
|
+
Dynamic: license-file
|
|
13
14
|
|
|
14
15
|
# Netbox Docker Plugin
|
|
15
16
|
|
|
@@ -19,6 +20,10 @@ Manage Docker with Netbox & style. Made to work with [netbox-docker-agent](https
|
|
|
19
20
|
|
|
20
21
|

|
|
21
22
|
|
|
23
|
+
Thanks [dzove855](https://github.com/dzove855) for the presentation of the plugin the 15th April 2025 during the Netbox Community Call.
|
|
24
|
+
|
|
25
|
+
[](https://youtu.be/gRamXtFAspQ?t=1870)
|
|
26
|
+
|
|
22
27
|
## How does it work?
|
|
23
28
|
|
|
24
29
|
```mermaid
|
|
@@ -32,12 +37,17 @@ sequenceDiagram
|
|
|
32
37
|
Once the plugin and webhooks are installed, you can:
|
|
33
38
|
|
|
34
39
|
1. Create hosts that point to
|
|
35
|
-
[agents](https://github.com/SaaShup/netbox-docker-agent) you had installed
|
|
40
|
+
[agents](https://github.com/SaaShup/netbox-docker-agent) you had installed *
|
|
36
41
|
2. Retrieve informations from Docker API with the help of the agent
|
|
37
42
|
3. Create containers on host with an image, expose ports, add env variables and
|
|
38
43
|
labels, mount volumes, set networks.
|
|
39
44
|
4. Manage the container status, start, stop, restart.
|
|
40
45
|
|
|
46
|
+
* adding a host with curl needs a specific **Origin** header to make it working. Example :
|
|
47
|
+
```
|
|
48
|
+
curl -X POST -H "Authorization: Token xxxxx" -H "Content-Type: application/json" -H "Origin: https://myhost" https://myhost/api/plugins/docker/hosts/ -d '{"name": "test-add", "endpoint": "[https://xxxx:xxxx@test.com:1990"}](https://xxxx:xxxx@test.com:1990%22%7D)'
|
|
49
|
+
```
|
|
50
|
+
|
|
41
51
|
## Installation
|
|
42
52
|
|
|
43
53
|
Below the compatibility list of the Netbox Docker PLugin and Netbox. Please chose the right version of the plugin depending of the Netbox version you use:
|
|
@@ -6,6 +6,10 @@ Manage Docker with Netbox & style. Made to work with [netbox-docker-agent](https
|
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
+
Thanks [dzove855](https://github.com/dzove855) for the presentation of the plugin the 15th April 2025 during the Netbox Community Call.
|
|
10
|
+
|
|
11
|
+
[](https://youtu.be/gRamXtFAspQ?t=1870)
|
|
12
|
+
|
|
9
13
|
## How does it work?
|
|
10
14
|
|
|
11
15
|
```mermaid
|
|
@@ -19,12 +23,17 @@ sequenceDiagram
|
|
|
19
23
|
Once the plugin and webhooks are installed, you can:
|
|
20
24
|
|
|
21
25
|
1. Create hosts that point to
|
|
22
|
-
[agents](https://github.com/SaaShup/netbox-docker-agent) you had installed
|
|
26
|
+
[agents](https://github.com/SaaShup/netbox-docker-agent) you had installed *
|
|
23
27
|
2. Retrieve informations from Docker API with the help of the agent
|
|
24
28
|
3. Create containers on host with an image, expose ports, add env variables and
|
|
25
29
|
labels, mount volumes, set networks.
|
|
26
30
|
4. Manage the container status, start, stop, restart.
|
|
27
31
|
|
|
32
|
+
* adding a host with curl needs a specific **Origin** header to make it working. Example :
|
|
33
|
+
```
|
|
34
|
+
curl -X POST -H "Authorization: Token xxxxx" -H "Content-Type: application/json" -H "Origin: https://myhost" https://myhost/api/plugins/docker/hosts/ -d '{"name": "test-add", "endpoint": "[https://xxxx:xxxx@test.com:1990"}](https://xxxx:xxxx@test.com:1990%22%7D)'
|
|
35
|
+
```
|
|
36
|
+
|
|
28
37
|
## Installation
|
|
29
38
|
|
|
30
39
|
Below the compatibility list of the Netbox Docker PLugin and Netbox. Please chose the right version of the plugin depending of the Netbox version you use:
|
|
@@ -11,7 +11,7 @@ class NetBoxDockerConfig(PluginConfig):
|
|
|
11
11
|
name = "netbox_docker_plugin"
|
|
12
12
|
verbose_name = " NetBox Docker Plugin"
|
|
13
13
|
description = "Manage Docker"
|
|
14
|
-
version = "3.0
|
|
14
|
+
version = "3.3.0"
|
|
15
15
|
base_url = "docker"
|
|
16
16
|
min_version = "4.1.0"
|
|
17
17
|
author = "Vincent Simonin <vincent@saashup.com>, David Delassus <david.jose.delassus@gmail.com>"
|
{netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/api/serializers.py
RENAMED
|
@@ -19,6 +19,7 @@ from ..models.container import (
|
|
|
19
19
|
Bind,
|
|
20
20
|
NetworkSetting,
|
|
21
21
|
Device,
|
|
22
|
+
LogDriverOption,
|
|
22
23
|
)
|
|
23
24
|
from ..models.registry import Registry
|
|
24
25
|
|
|
@@ -28,6 +29,7 @@ class NestedTokenSerializer(WritableNestedSerializer):
|
|
|
28
29
|
|
|
29
30
|
class Meta:
|
|
30
31
|
"""Nested Token Serializer Meta class"""
|
|
32
|
+
|
|
31
33
|
model = Token
|
|
32
34
|
fields = ["id", "url", "display_url", "display", "key", "write_enabled"]
|
|
33
35
|
|
|
@@ -95,6 +97,7 @@ class NestedVolumeSerializer(WritableNestedSerializer):
|
|
|
95
97
|
"url",
|
|
96
98
|
"display",
|
|
97
99
|
"name",
|
|
100
|
+
"max_size",
|
|
98
101
|
"driver",
|
|
99
102
|
)
|
|
100
103
|
|
|
@@ -106,7 +109,11 @@ class NestedVolumeSerializer(WritableNestedSerializer):
|
|
|
106
109
|
params = dict_to_filter_params(data)
|
|
107
110
|
if Volume.objects.filter(**params).count() == 0:
|
|
108
111
|
host = Host.objects.get(pk=params["host"])
|
|
109
|
-
volume = Volume(
|
|
112
|
+
volume = Volume(
|
|
113
|
+
host=host,
|
|
114
|
+
name=params["name"],
|
|
115
|
+
max_size=params.get("max_size"),
|
|
116
|
+
)
|
|
110
117
|
volume.save()
|
|
111
118
|
return volume
|
|
112
119
|
|
|
@@ -158,6 +165,7 @@ class NestedContainerSerializer(WritableNestedSerializer):
|
|
|
158
165
|
"operation",
|
|
159
166
|
"hostname",
|
|
160
167
|
"cap_add",
|
|
168
|
+
"log_driver",
|
|
161
169
|
)
|
|
162
170
|
|
|
163
171
|
|
|
@@ -263,6 +271,7 @@ class VolumeSerializer(NetBoxModelSerializer):
|
|
|
263
271
|
"display",
|
|
264
272
|
"host",
|
|
265
273
|
"name",
|
|
274
|
+
"max_size",
|
|
266
275
|
"driver",
|
|
267
276
|
"custom_fields",
|
|
268
277
|
"created",
|
|
@@ -331,6 +340,19 @@ class EnvSerializer(serializers.ModelSerializer):
|
|
|
331
340
|
)
|
|
332
341
|
|
|
333
342
|
|
|
343
|
+
class LogDriverOptionSerializer(serializers.ModelSerializer):
|
|
344
|
+
"""Container Log Driver Option Serializer class"""
|
|
345
|
+
|
|
346
|
+
class Meta:
|
|
347
|
+
"""Container Log Driver Option Serializer Meta class"""
|
|
348
|
+
|
|
349
|
+
model = LogDriverOption
|
|
350
|
+
fields = (
|
|
351
|
+
"option_name",
|
|
352
|
+
"value",
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
|
|
334
356
|
class LabelSerializer(serializers.ModelSerializer):
|
|
335
357
|
"""Container Label Serializer class"""
|
|
336
358
|
|
|
@@ -414,6 +436,7 @@ class ContainerSerializer(NetBoxModelSerializer):
|
|
|
414
436
|
binds = BindSerializer(many=True, required=False)
|
|
415
437
|
network_settings = NetworkSettingSerializer(many=True, required=False)
|
|
416
438
|
devices = DeviceSerializer(many=True, required=False)
|
|
439
|
+
log_driver_options = LogDriverOptionSerializer(many=True, required=False)
|
|
417
440
|
|
|
418
441
|
class Meta:
|
|
419
442
|
"""Container Serializer Meta class"""
|
|
@@ -440,6 +463,8 @@ class ContainerSerializer(NetBoxModelSerializer):
|
|
|
440
463
|
"binds",
|
|
441
464
|
"network_settings",
|
|
442
465
|
"devices",
|
|
466
|
+
"log_driver",
|
|
467
|
+
"log_driver_options",
|
|
443
468
|
"custom_fields",
|
|
444
469
|
"created",
|
|
445
470
|
"last_updated",
|
|
@@ -451,6 +476,7 @@ class ContainerSerializer(NetBoxModelSerializer):
|
|
|
451
476
|
attrs = data.copy()
|
|
452
477
|
attrs.pop("ports", None)
|
|
453
478
|
attrs.pop("env", None)
|
|
479
|
+
attrs.pop("log_driver_options", None)
|
|
454
480
|
attrs.pop("labels", None)
|
|
455
481
|
attrs.pop("mounts", None)
|
|
456
482
|
attrs.pop("binds", None)
|
|
@@ -465,6 +491,7 @@ class ContainerSerializer(NetBoxModelSerializer):
|
|
|
465
491
|
def create(self, validated_data):
|
|
466
492
|
ports_data = validated_data.pop("ports", None)
|
|
467
493
|
env_data = validated_data.pop("env", None)
|
|
494
|
+
log_driver_options_data = validated_data.pop("log_driver_options", None)
|
|
468
495
|
labels_data = validated_data.pop("labels", None)
|
|
469
496
|
mounts_data = validated_data.pop("mounts", None)
|
|
470
497
|
binds_data = validated_data.pop("binds", None)
|
|
@@ -481,6 +508,10 @@ class ContainerSerializer(NetBoxModelSerializer):
|
|
|
481
508
|
for env in env_data:
|
|
482
509
|
Env.objects.create(container=container, **env)
|
|
483
510
|
|
|
511
|
+
if log_driver_options_data is not None:
|
|
512
|
+
for option in log_driver_options_data:
|
|
513
|
+
LogDriverOption.objects.create(container=container, **option)
|
|
514
|
+
|
|
484
515
|
if labels_data is not None:
|
|
485
516
|
for label in labels_data:
|
|
486
517
|
Label.objects.create(container=container, **label)
|
|
@@ -515,6 +546,7 @@ class ContainerSerializer(NetBoxModelSerializer):
|
|
|
515
546
|
def update(self, instance, validated_data):
|
|
516
547
|
ports_data = validated_data.pop("ports", None)
|
|
517
548
|
env_data = validated_data.pop("env", None)
|
|
549
|
+
log_driver_options_data = validated_data.pop("log_driver_options", None)
|
|
518
550
|
labels_data = validated_data.pop("labels", None)
|
|
519
551
|
mounts_data = validated_data.pop("mounts", None)
|
|
520
552
|
binds_data = validated_data.pop("binds", None)
|
|
@@ -533,6 +565,11 @@ class ContainerSerializer(NetBoxModelSerializer):
|
|
|
533
565
|
for env in env_data:
|
|
534
566
|
Env.objects.create(container=container, **env)
|
|
535
567
|
|
|
568
|
+
if log_driver_options_data is not None:
|
|
569
|
+
LogDriverOption.objects.filter(container=container).delete()
|
|
570
|
+
for option in log_driver_options_data:
|
|
571
|
+
LogDriverOption.objects.create(container=container, **option)
|
|
572
|
+
|
|
536
573
|
if labels_data is not None:
|
|
537
574
|
Label.objects.filter(container=container).delete()
|
|
538
575
|
for label in labels_data:
|
{netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/filtersets.py
RENAMED
|
@@ -16,6 +16,7 @@ from .models.container import (
|
|
|
16
16
|
Bind,
|
|
17
17
|
NetworkSetting,
|
|
18
18
|
Device,
|
|
19
|
+
LogDriverOption,
|
|
19
20
|
)
|
|
20
21
|
from .models.registry import Registry
|
|
21
22
|
|
|
@@ -89,7 +90,15 @@ class ImageFilterSet(NetBoxModelFilterSet):
|
|
|
89
90
|
"""Image filterset definition meta class"""
|
|
90
91
|
|
|
91
92
|
model = Image
|
|
92
|
-
fields = (
|
|
93
|
+
fields = (
|
|
94
|
+
"id",
|
|
95
|
+
"name",
|
|
96
|
+
"version",
|
|
97
|
+
"size",
|
|
98
|
+
"ImageID",
|
|
99
|
+
"Digest",
|
|
100
|
+
"containers",
|
|
101
|
+
)
|
|
93
102
|
|
|
94
103
|
# pylint: disable=W0613
|
|
95
104
|
def search(self, queryset, name, value):
|
|
@@ -113,7 +122,7 @@ class VolumeFilterSet(NetBoxModelFilterSet):
|
|
|
113
122
|
"""Volume filterset definition meta class"""
|
|
114
123
|
|
|
115
124
|
model = Volume
|
|
116
|
-
fields = ("id", "name", "driver", "mounts")
|
|
125
|
+
fields = ("id", "name", "max_size", "driver", "mounts")
|
|
117
126
|
|
|
118
127
|
# pylint: disable=W0613
|
|
119
128
|
def search(self, queryset, name, value):
|
|
@@ -166,7 +175,14 @@ class ContainerFilterSet(NetBoxModelFilterSet):
|
|
|
166
175
|
"""Container filterset definition meta class"""
|
|
167
176
|
|
|
168
177
|
model = Container
|
|
169
|
-
fields = (
|
|
178
|
+
fields = (
|
|
179
|
+
"id",
|
|
180
|
+
"name",
|
|
181
|
+
"state",
|
|
182
|
+
"hostname",
|
|
183
|
+
"restart_policy",
|
|
184
|
+
"ContainerID",
|
|
185
|
+
)
|
|
170
186
|
|
|
171
187
|
# pylint: disable=W0613
|
|
172
188
|
def search(self, queryset, name, value):
|
|
@@ -195,6 +211,25 @@ class EnvFilterSet(BaseFilterSet):
|
|
|
195
211
|
)
|
|
196
212
|
|
|
197
213
|
|
|
214
|
+
class LogDriverOptionFilterSet(BaseFilterSet):
|
|
215
|
+
"""Log driver option filterset definition class"""
|
|
216
|
+
|
|
217
|
+
container_id = ModelMultipleChoiceFilter(
|
|
218
|
+
field_name="container_id",
|
|
219
|
+
queryset=Container.objects.all(),
|
|
220
|
+
label="Container (ID)",
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
class Meta:
|
|
224
|
+
"""Log driver option filterset definition meta class"""
|
|
225
|
+
|
|
226
|
+
model = LogDriverOption
|
|
227
|
+
fields = (
|
|
228
|
+
"id",
|
|
229
|
+
"option_name",
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
|
|
198
233
|
class LabelFilterSet(BaseFilterSet):
|
|
199
234
|
"""Label filterset definition class"""
|
|
200
235
|
|
{netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/container.py
RENAMED
|
@@ -15,7 +15,12 @@ from netbox.forms import (
|
|
|
15
15
|
)
|
|
16
16
|
from ..models.volume import Volume
|
|
17
17
|
from ..models.host import Host
|
|
18
|
-
from ..models.container import
|
|
18
|
+
from ..models.container import (
|
|
19
|
+
Container,
|
|
20
|
+
ContainerRestartPolicyChoices,
|
|
21
|
+
ContainerCapAddChoices,
|
|
22
|
+
ContainerLogDriverChoices,
|
|
23
|
+
)
|
|
19
24
|
from ..models.image import Image
|
|
20
25
|
|
|
21
26
|
|
|
@@ -44,6 +49,7 @@ class ContainerForm(NetBoxModelForm):
|
|
|
44
49
|
"hostname",
|
|
45
50
|
"restart_policy",
|
|
46
51
|
"cap_add",
|
|
52
|
+
"log_driver",
|
|
47
53
|
"tags",
|
|
48
54
|
)
|
|
49
55
|
labels = {
|
|
@@ -53,6 +59,7 @@ class ContainerForm(NetBoxModelForm):
|
|
|
53
59
|
"hostname": "Hostname",
|
|
54
60
|
"restart_policy": "Restart Policy",
|
|
55
61
|
"cap_add": "Add Host capabilities",
|
|
62
|
+
"log_driver": "Logging driver",
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
|
|
@@ -77,6 +84,7 @@ class ContainerEditForm(NetBoxModelForm):
|
|
|
77
84
|
"hostname",
|
|
78
85
|
"restart_policy",
|
|
79
86
|
"cap_add",
|
|
87
|
+
"log_driver",
|
|
80
88
|
"tags",
|
|
81
89
|
)
|
|
82
90
|
labels = {
|
|
@@ -85,6 +93,7 @@ class ContainerEditForm(NetBoxModelForm):
|
|
|
85
93
|
"hostname": "Hostname",
|
|
86
94
|
"restart_policy": "Restart Policy",
|
|
87
95
|
"cap_add": "Add Host capabilities",
|
|
96
|
+
"log_driver": "Logging driver",
|
|
88
97
|
}
|
|
89
98
|
|
|
90
99
|
|
|
@@ -112,6 +121,9 @@ class ContainerFilterForm(NetBoxModelFilterSetForm):
|
|
|
112
121
|
restart_policy = forms.ChoiceField(
|
|
113
122
|
label="Restart Policy", choices=ContainerRestartPolicyChoices, required=False
|
|
114
123
|
)
|
|
124
|
+
log_driver = forms.ChoiceField(
|
|
125
|
+
label="Logging driver", choices=ContainerLogDriverChoices, required=False
|
|
126
|
+
)
|
|
115
127
|
tag = TagFilterField(model)
|
|
116
128
|
|
|
117
129
|
|
|
@@ -126,6 +138,13 @@ class ContainerImportForm(NetBoxModelImportForm):
|
|
|
126
138
|
+ "`always`, `unless-stopped`.",
|
|
127
139
|
)
|
|
128
140
|
|
|
141
|
+
log_driver = forms.ChoiceField(
|
|
142
|
+
label="Logging driver",
|
|
143
|
+
choices=ContainerLogDriverChoices,
|
|
144
|
+
required=False,
|
|
145
|
+
help_text="Logging driver. Can be `json-log`, `syslog`.",
|
|
146
|
+
)
|
|
147
|
+
|
|
129
148
|
class Meta:
|
|
130
149
|
"""Container importation form definition Meta class"""
|
|
131
150
|
|
|
@@ -151,12 +170,17 @@ class ContainerBulkEditForm(NetBoxModelBulkEditForm):
|
|
|
151
170
|
choices=ContainerRestartPolicyChoices,
|
|
152
171
|
required=True,
|
|
153
172
|
)
|
|
173
|
+
log_driver = forms.ChoiceField(
|
|
174
|
+
label="Logging driver",
|
|
175
|
+
choices=ContainerLogDriverChoices,
|
|
176
|
+
required=True,
|
|
177
|
+
)
|
|
154
178
|
hostname = forms.CharField(
|
|
155
179
|
label="Hostname", max_length=256, min_length=1, required=False
|
|
156
180
|
)
|
|
157
181
|
|
|
158
182
|
model = Container
|
|
159
|
-
fieldsets = (FieldSet("restart_policy", "hostname", name="General"),)
|
|
183
|
+
fieldsets = (FieldSet("restart_policy", "log_driver", "hostname", name="General"),)
|
|
160
184
|
|
|
161
185
|
|
|
162
186
|
class ContainerOperationForm(NetBoxModelForm):
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Log Driver option Form definition"""
|
|
2
|
+
|
|
3
|
+
from django import forms
|
|
4
|
+
from utilities.forms.fields import DynamicModelChoiceField
|
|
5
|
+
from ..models.container import LogDriverOption, Container
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class LogDriverOptionForm(forms.ModelForm):
|
|
9
|
+
"""Log Driver option form definition class"""
|
|
10
|
+
|
|
11
|
+
container = DynamicModelChoiceField(
|
|
12
|
+
label="Container", queryset=Container.objects.all(), required=True
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
class Meta:
|
|
16
|
+
"""Log Driver option form definition Meta class"""
|
|
17
|
+
|
|
18
|
+
model = LogDriverOption
|
|
19
|
+
fields = (
|
|
20
|
+
"container",
|
|
21
|
+
"option_name",
|
|
22
|
+
"value",
|
|
23
|
+
)
|
|
24
|
+
labels = {
|
|
25
|
+
"container": "Container",
|
|
26
|
+
"option_name": "Option Name",
|
|
27
|
+
"value": "Value",
|
|
28
|
+
}
|
{netbox_docker_plugin-3.0.1 → netbox_docker_plugin-3.3.0}/netbox_docker_plugin/forms/volume.py
RENAMED
|
@@ -21,11 +21,13 @@ class VolumeForm(NetBoxModelForm):
|
|
|
21
21
|
fields = (
|
|
22
22
|
"host",
|
|
23
23
|
"name",
|
|
24
|
+
"max_size",
|
|
24
25
|
"driver",
|
|
25
26
|
"tags",
|
|
26
27
|
)
|
|
27
28
|
labels = {
|
|
28
29
|
"name": "Name",
|
|
30
|
+
"max_size": "Optional Maximum Size of Volume (in MB)",
|
|
29
31
|
"host": "Host",
|
|
30
32
|
"driver": "Driver",
|
|
31
33
|
}
|
|
@@ -36,6 +38,7 @@ class VolumeFilterForm(NetBoxModelFilterSetForm):
|
|
|
36
38
|
|
|
37
39
|
model = Volume
|
|
38
40
|
name = forms.CharField(label="Name", max_length=256, min_length=1, required=False)
|
|
41
|
+
max_size = forms.IntegerField(label="Max Size (MB)", required=False)
|
|
39
42
|
driver = forms.ChoiceField(
|
|
40
43
|
label="Driver",
|
|
41
44
|
choices=VolumeDriverChoices,
|
|
@@ -58,9 +61,10 @@ class VolumeImportForm(NetBoxModelImportForm):
|
|
|
58
61
|
"""Volume importation form definition Meta class"""
|
|
59
62
|
|
|
60
63
|
model = Volume
|
|
61
|
-
fields = ("name", "driver", "host")
|
|
64
|
+
fields = ("name", "max_size", "driver", "host")
|
|
62
65
|
labels = {
|
|
63
66
|
"name": "Unique Image name",
|
|
67
|
+
"max_size": "Optional Maximum Size of Volume (in MB)",
|
|
64
68
|
"driver": 'Volume provider. Can be "local"',
|
|
65
69
|
"host": "Host identifier",
|
|
66
70
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# pylint: disable=C0103
|
|
2
|
+
"""Migration file"""
|
|
3
|
+
|
|
4
|
+
import django.contrib.postgres.fields
|
|
5
|
+
from django.db import migrations, models
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Migration(migrations.Migration):
|
|
9
|
+
"""Migration file"""
|
|
10
|
+
|
|
11
|
+
dependencies = [
|
|
12
|
+
(
|
|
13
|
+
"netbox_docker_plugin",
|
|
14
|
+
"0030_alter_container_containerid_alter_container_hostname_and_more",
|
|
15
|
+
),
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
operations = [
|
|
19
|
+
migrations.RunSQL(
|
|
20
|
+
"ALTER TABLE netbox_docker_plugin_container "
|
|
21
|
+
+ "ADD COLUMN IF NOT EXISTS cap_add character varying(32)[];",
|
|
22
|
+
state_operations=[
|
|
23
|
+
migrations.AddField(
|
|
24
|
+
model_name="container",
|
|
25
|
+
name="cap_add",
|
|
26
|
+
field=django.contrib.postgres.fields.ArrayField(
|
|
27
|
+
base_field=models.CharField(
|
|
28
|
+
blank=True, max_length=32, null=True
|
|
29
|
+
),
|
|
30
|
+
blank=True,
|
|
31
|
+
null=True,
|
|
32
|
+
size=None,
|
|
33
|
+
),
|
|
34
|
+
),
|
|
35
|
+
],
|
|
36
|
+
)
|
|
37
|
+
]
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# pylint: disable=C0103
|
|
2
|
+
"""Migration file"""
|
|
3
|
+
|
|
4
|
+
import django.core.validators
|
|
5
|
+
import django.db.models.deletion
|
|
6
|
+
from django.db import migrations, models
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Migration(migrations.Migration):
|
|
10
|
+
"""Migration file"""
|
|
11
|
+
|
|
12
|
+
dependencies = [
|
|
13
|
+
("netbox_docker_plugin", "0031_container_cap_add"),
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
operations = [
|
|
17
|
+
migrations.RunSQL(
|
|
18
|
+
"""
|
|
19
|
+
CREATE TABLE IF NOT EXISTS public.netbox_docker_plugin_device
|
|
20
|
+
(
|
|
21
|
+
id bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
|
22
|
+
host_path character varying(1024) NOT NULL,
|
|
23
|
+
container_path character varying(1024) NOT NULL,
|
|
24
|
+
container_id bigint NOT NULL,
|
|
25
|
+
CONSTRAINT netbox_docker_plugin_device_pkey PRIMARY KEY (id),
|
|
26
|
+
CONSTRAINT netbox_docker_plugin_device_unique_device UNIQUE
|
|
27
|
+
(container_id, container_path, host_path),
|
|
28
|
+
CONSTRAINT netbox_docker_plugin_container_id_a53ca874_fk_netbox_do FOREIGN KEY (container_id)
|
|
29
|
+
REFERENCES public.netbox_docker_plugin_container (id) MATCH SIMPLE
|
|
30
|
+
ON UPDATE NO ACTION
|
|
31
|
+
ON DELETE NO ACTION
|
|
32
|
+
DEFERRABLE INITIALLY DEFERRED
|
|
33
|
+
);
|
|
34
|
+
CREATE INDEX IF NOT EXISTS netbox_docker_plugin_device_container_id_a53ca874
|
|
35
|
+
ON public.netbox_docker_plugin_device USING btree
|
|
36
|
+
(container_id ASC NULLS LAST);
|
|
37
|
+
""",
|
|
38
|
+
state_operations=
|
|
39
|
+
[
|
|
40
|
+
migrations.CreateModel(
|
|
41
|
+
name="Device",
|
|
42
|
+
fields=[
|
|
43
|
+
(
|
|
44
|
+
"id",
|
|
45
|
+
models.BigAutoField(
|
|
46
|
+
auto_created=True, primary_key=True, serialize=False
|
|
47
|
+
),
|
|
48
|
+
),
|
|
49
|
+
(
|
|
50
|
+
"host_path",
|
|
51
|
+
models.CharField(
|
|
52
|
+
max_length=1024,
|
|
53
|
+
validators=[
|
|
54
|
+
django.core.validators.MinLengthValidator(
|
|
55
|
+
limit_value=1
|
|
56
|
+
),
|
|
57
|
+
django.core.validators.MaxLengthValidator(
|
|
58
|
+
limit_value=1024
|
|
59
|
+
),
|
|
60
|
+
],
|
|
61
|
+
),
|
|
62
|
+
),
|
|
63
|
+
(
|
|
64
|
+
"container_path",
|
|
65
|
+
models.CharField(
|
|
66
|
+
max_length=1024,
|
|
67
|
+
validators=[
|
|
68
|
+
django.core.validators.MinLengthValidator(
|
|
69
|
+
limit_value=1
|
|
70
|
+
),
|
|
71
|
+
django.core.validators.MaxLengthValidator(
|
|
72
|
+
limit_value=1024
|
|
73
|
+
),
|
|
74
|
+
],
|
|
75
|
+
),
|
|
76
|
+
),
|
|
77
|
+
(
|
|
78
|
+
"container",
|
|
79
|
+
models.ForeignKey(
|
|
80
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
81
|
+
related_name="devices",
|
|
82
|
+
to="netbox_docker_plugin.container",
|
|
83
|
+
),
|
|
84
|
+
),
|
|
85
|
+
],
|
|
86
|
+
options={
|
|
87
|
+
"ordering": ("container", "container_path", "host_path"),
|
|
88
|
+
},
|
|
89
|
+
),
|
|
90
|
+
migrations.AddConstraint(
|
|
91
|
+
model_name="device",
|
|
92
|
+
constraint=models.UniqueConstraint(
|
|
93
|
+
fields=("container", "container_path", "host_path"),
|
|
94
|
+
name="netbox_docker_plugin_device_unique_device",
|
|
95
|
+
),
|
|
96
|
+
),
|
|
97
|
+
],
|
|
98
|
+
),
|
|
99
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# pylint: disable=C0103
|
|
2
|
+
"""Migration file"""
|
|
3
|
+
|
|
4
|
+
from django.db import migrations, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
"""Migration file"""
|
|
9
|
+
|
|
10
|
+
dependencies = [
|
|
11
|
+
("netbox_docker_plugin", "0032_device_and_more"),
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
operations = [
|
|
15
|
+
migrations.RunSQL(
|
|
16
|
+
"ALTER TABLE netbox_docker_plugin_host "
|
|
17
|
+
+ "ADD COLUMN IF NOT EXISTS operation character varying(32);",
|
|
18
|
+
state_operations=[
|
|
19
|
+
migrations.AddField(
|
|
20
|
+
model_name="host",
|
|
21
|
+
name="operation",
|
|
22
|
+
field=models.CharField(default="none", max_length=32),
|
|
23
|
+
),
|
|
24
|
+
],
|
|
25
|
+
)
|
|
26
|
+
]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# pylint: disable=C0103
|
|
2
|
+
"""Migration file"""
|
|
3
|
+
|
|
4
|
+
from django.db import migrations, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
"""Migration file"""
|
|
9
|
+
|
|
10
|
+
dependencies = [
|
|
11
|
+
("netbox_docker_plugin", "0033_host_operation"),
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
operations = [
|
|
15
|
+
migrations.AddField(
|
|
16
|
+
model_name="volume",
|
|
17
|
+
name="max_size",
|
|
18
|
+
field=models.PositiveIntegerField(
|
|
19
|
+
null=True,
|
|
20
|
+
blank=True,
|
|
21
|
+
default=None,
|
|
22
|
+
),
|
|
23
|
+
),
|
|
24
|
+
]
|