netbox-docker-plugin 1.6.0__tar.gz → 1.6.2__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-1.6.0/netbox_docker_plugin.egg-info → netbox_docker_plugin-1.6.2}/PKG-INFO +1 -1
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/__init__.py +1 -1
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/api/serializers.py +17 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/container/test_container_api.py +1 -0
- netbox_docker_plugin-1.6.2/netbox_docker_plugin/tests/volume/test_volume_api.py +122 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/container.py +1 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/host.py +1 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/image.py +1 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/network.py +1 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/volume.py +1 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2/netbox_docker_plugin.egg-info}/PKG-INFO +1 -1
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/pyproject.toml +1 -1
- netbox_docker_plugin-1.6.0/netbox_docker_plugin/tests/volume/test_volume_api.py +0 -44
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/LICENSE +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/MANIFEST.in +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/README.md +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/api/__init__.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/api/urls.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/api/views.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/filtersets.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/__init__.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/bind.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/container.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/env.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/host.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/image.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/label.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/mount.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/network.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/network_setting.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/port.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/registry.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/volume.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0001_initial.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0002_image.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0003_image_size.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0004_volume.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0005_network.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0006_container_port_mount_label_env_and_more.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0007_remove_container_netbox_docker_plugin_container_unique_name_host__and_more.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0008_alter_network_unique_together_network_networkid_and_more.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0009_remove_container_network_networksettings_and_more.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0010_container_containerid_and_more.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0011_host_token.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0012_host_state.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0013_host_netbox_url.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0014_container_operation.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0015_remove_mount_netbox_docker_plugin_mount_unique_volume_and_more.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0016_alter_env_value.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0017_network_state.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0018_alter_mount_volume_alter_networksetting_network.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0019_host_agent_version_host_docker_api_version.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0020_container_hostname.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0021_registry_and_more.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0022_bind_bind_netbox_docker_plugin_bind_unique_bind.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0023_delete_hosts.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0024_registry_host_alter_registry_name_and_more.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0025_alter_image_version.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0026_image_digest.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/0027_container_restart_policy.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/migrations/__init__.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/models/__init__.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/models/container.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/models/host.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/models/image.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/models/network.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/models/registry.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/models/volume.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/navigation.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tables.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/templates/netbox_docker_plugin/container.html +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/templates/netbox_docker_plugin/host.html +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/templates/netbox_docker_plugin/image.html +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/templates/netbox_docker_plugin/network.html +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/templates/netbox_docker_plugin/registry.html +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/templates/netbox_docker_plugin/volume.html +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/templatetags/__init__.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/templatetags/host.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/__init__.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/base.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/container/__init__.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/container/test_container_operation_view.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/container/test_container_validation.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/container/test_container_views.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/host/__init__.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/host/test_host_api.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/host/test_host_views.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/host/test_replace_password.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/image/__init__.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/image/test_image_api.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/image/test_image_views.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/network/__init__.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/network/test_network_api.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/network/test_network_views.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/registry/__init__.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/registry/test_registry_api.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/registry/test_registry_views.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/test_init.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/volume/__init__.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/volume/test_volume_views.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/urls.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/utilities/__init__.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/__init__.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/bind.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/env.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/label.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/mount.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/network_setting.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/port.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/registry.py +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin.egg-info/SOURCES.txt +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin.egg-info/dependency_links.txt +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin.egg-info/top_level.txt +0 -0
- {netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/setup.cfg +0 -0
|
@@ -10,7 +10,7 @@ class NetBoxDockerConfig(PluginConfig):
|
|
|
10
10
|
name = "netbox_docker_plugin"
|
|
11
11
|
verbose_name = " NetBox Docker Plugin"
|
|
12
12
|
description = "Manage Docker"
|
|
13
|
-
version = "1.6.
|
|
13
|
+
version = "1.6.2"
|
|
14
14
|
base_url = "docker"
|
|
15
15
|
author= "Vincent Simonin"
|
|
16
16
|
author_email= "vincent@saashup.com"
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/api/serializers.py
RENAMED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# pylint: disable=E1101
|
|
4
4
|
|
|
5
5
|
from rest_framework import serializers
|
|
6
|
+
from utilities.utils import dict_to_filter_params
|
|
6
7
|
from users.api.nested_serializers import NestedTokenSerializer
|
|
7
8
|
from netbox.api.serializers import NetBoxModelSerializer, WritableNestedSerializer
|
|
8
9
|
from ..models.host import Host
|
|
@@ -86,6 +87,20 @@ class NestedVolumeSerializer(WritableNestedSerializer):
|
|
|
86
87
|
"driver",
|
|
87
88
|
)
|
|
88
89
|
|
|
90
|
+
def to_internal_value(self, data):
|
|
91
|
+
if data is None:
|
|
92
|
+
return None
|
|
93
|
+
|
|
94
|
+
if isinstance(data, dict):
|
|
95
|
+
params = dict_to_filter_params(data)
|
|
96
|
+
if Volume.objects.filter(**params).count() == 0:
|
|
97
|
+
host = Host.objects.get(pk=params["host"])
|
|
98
|
+
volume = Volume(host= host, name= params["name"])
|
|
99
|
+
volume.save()
|
|
100
|
+
return volume
|
|
101
|
+
|
|
102
|
+
return super().to_internal_value(data)
|
|
103
|
+
|
|
89
104
|
|
|
90
105
|
class NestedNetworkSerializer(WritableNestedSerializer):
|
|
91
106
|
"""Nested Network Serializer class"""
|
|
@@ -123,6 +138,7 @@ class NestedContainerSerializer(WritableNestedSerializer):
|
|
|
123
138
|
fields = (
|
|
124
139
|
"id",
|
|
125
140
|
"url",
|
|
141
|
+
"display",
|
|
126
142
|
"name",
|
|
127
143
|
"ContainerID",
|
|
128
144
|
"state",
|
|
@@ -374,6 +390,7 @@ class ContainerSerializer(NetBoxModelSerializer):
|
|
|
374
390
|
fields = (
|
|
375
391
|
"id",
|
|
376
392
|
"url",
|
|
393
|
+
"display",
|
|
377
394
|
"host",
|
|
378
395
|
"image",
|
|
379
396
|
"name",
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""Volume Test Case"""
|
|
2
|
+
|
|
3
|
+
from django.urls import reverse
|
|
4
|
+
from django.contrib.contenttypes.models import ContentType
|
|
5
|
+
from rest_framework import status
|
|
6
|
+
from users.models import ObjectPermission
|
|
7
|
+
from utilities.testing import APIViewTestCases
|
|
8
|
+
from netbox_docker_plugin.models.host import Host
|
|
9
|
+
from netbox_docker_plugin.models.volume import Volume
|
|
10
|
+
from netbox_docker_plugin.models.image import Image
|
|
11
|
+
from netbox_docker_plugin.models.registry import Registry
|
|
12
|
+
from netbox_docker_plugin.models.container import Container, Mount
|
|
13
|
+
from netbox_docker_plugin.tests.base import BaseAPITestCase
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class VolumeApiTestCase(
|
|
17
|
+
BaseAPITestCase,
|
|
18
|
+
APIViewTestCases.GetObjectViewTestCase,
|
|
19
|
+
APIViewTestCases.ListObjectsViewTestCase,
|
|
20
|
+
APIViewTestCases.CreateObjectViewTestCase,
|
|
21
|
+
APIViewTestCases.UpdateObjectViewTestCase,
|
|
22
|
+
APIViewTestCases.DeleteObjectViewTestCase,
|
|
23
|
+
):
|
|
24
|
+
"""Volume Test Case Class"""
|
|
25
|
+
|
|
26
|
+
model = Volume
|
|
27
|
+
brief_fields = ["display", "driver", "id", "name", "url"]
|
|
28
|
+
|
|
29
|
+
@classmethod
|
|
30
|
+
def setUpTestData(cls) -> None:
|
|
31
|
+
host1 = Host.objects.create(endpoint="http://localhost:8080", name="host1")
|
|
32
|
+
host2 = Host.objects.create(endpoint="http://localhost:8080", name="host2")
|
|
33
|
+
|
|
34
|
+
Volume.objects.create(host=host1, name="volume1")
|
|
35
|
+
Volume.objects.create(host=host1, name="volume2")
|
|
36
|
+
Volume.objects.create(host=host2, name="volume3")
|
|
37
|
+
|
|
38
|
+
cls.create_data = [
|
|
39
|
+
{
|
|
40
|
+
"host": host1.pk,
|
|
41
|
+
"name": "volume4",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"host": host1.pk,
|
|
45
|
+
"name": "volume5",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"host": host2.pk,
|
|
49
|
+
"name": "volume6",
|
|
50
|
+
},
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
def test_that_embedded_anonymous_volume_is_created(self):
|
|
54
|
+
"""Test that embedded anonymous Volume is created on Container update"""
|
|
55
|
+
|
|
56
|
+
# Assign model-level permission
|
|
57
|
+
obj_perm = ObjectPermission(
|
|
58
|
+
name="Test permission", actions=["add", "change", "view"]
|
|
59
|
+
)
|
|
60
|
+
obj_perm.save()
|
|
61
|
+
# pylint: disable=E1101
|
|
62
|
+
obj_perm.users.add(self.user)
|
|
63
|
+
# pylint: disable=E1101
|
|
64
|
+
obj_perm.object_types.add(ContentType.objects.get_for_model(self.model))
|
|
65
|
+
obj_perm.object_types.add(ContentType.objects.get_for_model(Container))
|
|
66
|
+
obj_perm.object_types.add(ContentType.objects.get_for_model(Mount))
|
|
67
|
+
obj_perm.object_types.add(ContentType.objects.get_for_model(Image))
|
|
68
|
+
|
|
69
|
+
host = Host.objects.create(endpoint="http://localhost:8088", name="host8")
|
|
70
|
+
|
|
71
|
+
registry = Registry.objects.create(
|
|
72
|
+
host=host, name="registry8", serveraddress="http://localhost:8089"
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
image = Image.objects.create(host=host, name="image8", registry=registry)
|
|
76
|
+
|
|
77
|
+
container = Container.objects.create(host=host, image=image, name="container8")
|
|
78
|
+
|
|
79
|
+
response = self.client.patch(
|
|
80
|
+
reverse(f"plugins-api:{self._get_view_namespace()}:container-list"),
|
|
81
|
+
# pylint: disable=C0301
|
|
82
|
+
[
|
|
83
|
+
{
|
|
84
|
+
"id": container.pk,
|
|
85
|
+
"host": host.pk,
|
|
86
|
+
"mounts": [
|
|
87
|
+
{
|
|
88
|
+
"source": "/var/lib/docker/volumes/2419be4bd98f41a8e625c9e4479c1c5b0f8da4b5807f08a0340aa7a2e1574fdd/_data",
|
|
89
|
+
"volume": {
|
|
90
|
+
"name": "2419be4bd98f41a8e625c9e4479c1c5b0f8da4b5807f08a0340aa7a2e1574fdd",
|
|
91
|
+
"host": host.pk,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"source": "/var/lib/docker/volumes/844654ee4ac9d716679ed38b83c4ab6830a9db60ebf3fb2c000c7454bc41e9e2/_data",
|
|
96
|
+
"volume": {
|
|
97
|
+
"name": "844654ee4ac9d716679ed38b83c4ab6830a9db60ebf3fb2c000c7454bc41e9e2",
|
|
98
|
+
"host": host.pk,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
format="json",
|
|
105
|
+
**self.header,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
self.assertHttpStatus(response, status.HTTP_200_OK)
|
|
109
|
+
|
|
110
|
+
self.assertTrue(
|
|
111
|
+
Volume.objects.filter(
|
|
112
|
+
name="2419be4bd98f41a8e625c9e4479c1c5b0f8da4b5807f08a0340aa7a2e1574fdd",
|
|
113
|
+
host=host.pk,
|
|
114
|
+
).exists()
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
self.assertTrue(
|
|
118
|
+
Volume.objects.filter(
|
|
119
|
+
name="844654ee4ac9d716679ed38b83c4ab6830a9db60ebf3fb2c000c7454bc41e9e2",
|
|
120
|
+
host=host.pk,
|
|
121
|
+
).exists()
|
|
122
|
+
)
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/container.py
RENAMED
|
@@ -81,6 +81,7 @@ class ContainerBulkDeleteView(generic.BulkDeleteView):
|
|
|
81
81
|
class ContainerDeleteView(generic.ObjectDeleteView):
|
|
82
82
|
"""Container delete view definition"""
|
|
83
83
|
|
|
84
|
+
default_return_url = "plugins:netbox_docker_plugin:container_list"
|
|
84
85
|
queryset = Container.objects.all()
|
|
85
86
|
|
|
86
87
|
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"""Volume Test Case"""
|
|
2
|
-
|
|
3
|
-
from utilities.testing import APIViewTestCases
|
|
4
|
-
from netbox_docker_plugin.models.host import Host
|
|
5
|
-
from netbox_docker_plugin.models.volume import Volume
|
|
6
|
-
from netbox_docker_plugin.tests.base import BaseAPITestCase
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class VolumeApiTestCase(
|
|
10
|
-
BaseAPITestCase,
|
|
11
|
-
APIViewTestCases.GetObjectViewTestCase,
|
|
12
|
-
APIViewTestCases.ListObjectsViewTestCase,
|
|
13
|
-
APIViewTestCases.CreateObjectViewTestCase,
|
|
14
|
-
APIViewTestCases.UpdateObjectViewTestCase,
|
|
15
|
-
APIViewTestCases.DeleteObjectViewTestCase,
|
|
16
|
-
):
|
|
17
|
-
"""Volume Test Case Class"""
|
|
18
|
-
|
|
19
|
-
model = Volume
|
|
20
|
-
brief_fields = ["display", "driver", "id", "name", "url"]
|
|
21
|
-
|
|
22
|
-
@classmethod
|
|
23
|
-
def setUpTestData(cls) -> None:
|
|
24
|
-
host1 = Host.objects.create(endpoint="http://localhost:8080", name="host1")
|
|
25
|
-
host2 = Host.objects.create(endpoint="http://localhost:8080", name="host2")
|
|
26
|
-
|
|
27
|
-
Volume.objects.create(host=host1, name="volume1")
|
|
28
|
-
Volume.objects.create(host=host1, name="volume2")
|
|
29
|
-
Volume.objects.create(host=host2, name="volume3")
|
|
30
|
-
|
|
31
|
-
cls.create_data = [
|
|
32
|
-
{
|
|
33
|
-
"host": host1.pk,
|
|
34
|
-
"name": "volume4",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"host": host1.pk,
|
|
38
|
-
"name": "volume5",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"host": host2.pk,
|
|
42
|
-
"name": "volume6",
|
|
43
|
-
},
|
|
44
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/api/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/filtersets.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/__init__.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/bind.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/container.py
RENAMED
|
File without changes
|
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/host.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/image.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/label.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/mount.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/network.py
RENAMED
|
File without changes
|
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/port.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/registry.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/forms/volume.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/models/__init__.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/models/container.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/models/host.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/models/image.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/models/network.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/models/registry.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/models/volume.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/navigation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/templatetags/host.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/__init__.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/tests/test_init.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/utilities/__init__.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/__init__.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/bind.py
RENAMED
|
File without changes
|
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/label.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/mount.py
RENAMED
|
File without changes
|
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/port.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin/views/registry.py
RENAMED
|
File without changes
|
{netbox_docker_plugin-1.6.0 → netbox_docker_plugin-1.6.2}/netbox_docker_plugin.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|