Repository: SaaShup/netbox-docker-plugin (language: python)

Issue:
Increase to 256 char the Image version length



Discussion / hints:

Fix patch:
diff --git a/netbox_docker_plugin/__init__.py b/netbox_docker_plugin/__init__.py
index 98ba30f..b518fa2 100644
--- a/netbox_docker_plugin/__init__.py
+++ b/netbox_docker_plugin/__init__.py
@@ -10,7 +10,7 @@ class NetBoxDockerConfig(PluginConfig):
     name = "netbox_docker_plugin"
     verbose_name = " NetBox Docker Plugin"
     description = "Manage Docker"
-    version = "1.5.1"
+    version = "1.5.2"
     base_url = "docker"
     author= "Vincent Simonin"
     author_email= "vincent@saashup.com"
diff --git a/netbox_docker_plugin/migrations/0025_alter_image_version.py b/netbox_docker_plugin/migrations/0025_alter_image_version.py
new file mode 100644
index 0000000..8dd870c
--- /dev/null
+++ b/netbox_docker_plugin/migrations/0025_alter_image_version.py
@@ -0,0 +1,28 @@
+# pylint: disable=C0103
+"""Migration file"""
+
+import django.core.validators
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+    """Migration file"""
+
+    dependencies = [
+        ("netbox_docker_plugin", "0024_registry_host_alter_registry_name_and_more"),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name="image",
+            name="version",
+            field=models.CharField(
+                default="latest",
+                max_length=256,
+                validators=[
+                    django.core.validators.MinLengthValidator(limit_value=1),
+                    django.core.validators.MaxLengthValidator(limit_value=256),
+                ],
+            ),
+        ),
+    ]
diff --git a/netbox_docker_plugin/models/image.py b/netbox_docker_plugin/models/image.py
index 3a4c813..893eb5f 100644
--- a/netbox_docker_plugin/models/image.py
+++ b/netbox_docker_plugin/models/image.py
@@ -31,10 +31,10 @@ class Image(NetBoxModel):
     )
     version = models.CharField(
         default="latest",
-        max_length=32,
+        max_length=256,
         validators=[
             MinLengthValidator(limit_value=1),
-            MaxLengthValidator(limit_value=32),
+            MaxLengthValidator(limit_value=256),
         ],
     )
     size = models.IntegerField(
diff --git a/pyproject.toml b/pyproject.toml
index 81fecf0..a265b1e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
 
 [project]
 name = "netbox-docker-plugin"
-version = "1.5.1"
+version = "1.5.2"
 authors = [
   { name="Vincent Simonin", email="vincent@saashup.com" },
 ]


Test patch:
diff --git a/netbox_docker_plugin/tests/image/test_image_api.py b/netbox_docker_plugin/tests/image/test_image_api.py
index 4737934..5ea7a16 100644
--- a/netbox_docker_plugin/tests/image/test_image_api.py
+++ b/netbox_docker_plugin/tests/image/test_image_api.py
@@ -58,6 +58,10 @@ def setUpTestData(cls) -> None:
             {
                 "host": host2.pk,
                 "name": "image6",
+                "version": "testtesttesttesttesttesttesttesttesttesttesttesttest"
+                + "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttes"
+                + "ttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestte"
+                + "sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestt",
                 "registry": registry.pk,
             },
         ]