Skip to content

Commit d2a4ee4

Browse files
committed
🗃️ Made possible to set public port to -1
1 parent b184da0 commit d2a4ee4

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

netbox_docker_plugin/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class NetBoxDockerConfig(PluginConfig):
1111
name = "netbox_docker_plugin"
1212
verbose_name = " NetBox Docker Plugin"
1313
description = "Manage Docker"
14-
version = "4.2.0"
14+
version = "4.3.0"
1515
base_url = "docker"
1616
min_version = "4.2.0"
1717
author = "Vincent Simonin <vincent@saashup.com>, David Delassus <david.jose.delassus@gmail.com>"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# pylint: disable=C0103
2+
"""Migration file"""
3+
4+
import django.core.validators
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
"""Migration file"""
10+
11+
dependencies = [
12+
("netbox_docker_plugin", "0038_container_cmd"),
13+
]
14+
15+
operations = [
16+
migrations.AlterField(
17+
model_name="port",
18+
name="public_port",
19+
field=models.IntegerField(
20+
validators=[
21+
django.core.validators.MinValueValidator(limit_value=-1),
22+
django.core.validators.MaxValueValidator(limit_value=65535),
23+
]
24+
),
25+
),
26+
]

netbox_docker_plugin/models/container.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class Port(models.Model):
256256
)
257257
public_port = models.IntegerField(
258258
validators=[
259-
MinValueValidator(limit_value=0),
259+
MinValueValidator(limit_value=-1),
260260
MaxValueValidator(limit_value=65535),
261261
],
262262
)

netbox_docker_plugin/tests/container/test_container_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ def setUpTestData(cls) -> None:
108108
"ports": [
109109
{"public_port": 80, "private_port": 80, "type": "tcp"},
110110
{"public_port": 443, "private_port": 443, "type": "tcp"},
111+
{"public_port": 0, "private_port": 8080, "type": "tcp"},
112+
{"public_port": -1, "private_port": 8080, "type": "tcp"},
111113
],
112114
"env": [
113115
{"var_name": "ENV", "value": "prod"},

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "netbox-docker-plugin"
7-
version = "4.2.0"
7+
version = "4.3.0"
88
authors = [
99
{ name="Vincent Simonin", email="vincent@saashup.com" },
1010
{ name="David Delassus", email="david.jose.delassus@gmail.com" }

0 commit comments

Comments
 (0)