diff --git a/CHANGELOG.md b/CHANGELOG.md index 45e9909..9191db7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ * Support NetBox v4.6.5 * Replace the Docker-based setup with Git/Pip installation documentation +* Render tenant group and tenant in a dedicated license form section +* Bump the package version so Git/Pip upgrades replace older installations ## [1.9.0](https://github.com/ICTU/netbox_slm/releases/tag/1.9.0) - 2026-06-25 diff --git a/README.md b/README.md index 67ae952..a75e532 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,8 @@ grep -qxF "git+https://git.mrblake.cc/MrBlake/NetBox-SLM.git" /opt/netbox/local_ Die Installation muss im Python-Virtual-Environment von NetBox erfolgen: ```bash -/opt/netbox/venv/bin/pip install "git+https://git.mrblake.cc/MrBlake/NetBox-SLM.git" +/opt/netbox/venv/bin/pip install --upgrade --force-reinstall \ + "git+https://git.mrblake.cc/MrBlake/NetBox-SLM.git" ``` Alternativ können alle lokalen Anforderungen installiert werden: @@ -47,6 +48,14 @@ Alternativ können alle lokalen Anforderungen installiert werden: /opt/netbox/venv/bin/pip install -r /opt/netbox/local_requirements.txt ``` +Die installierte Version kann anschließend geprüft werden: + +```bash +/opt/netbox/venv/bin/pip show netbox-slm +``` + +Für diese Variante muss dort mindestens Version `1.9.1` stehen. + ### 3. Plugin in NetBox aktivieren In `/opt/netbox/netbox/netbox/configuration.py` ergänzen: diff --git a/netbox_slm/__init__.py b/netbox_slm/__init__.py index b3e34c8..c6e0b71 100644 --- a/netbox_slm/__init__.py +++ b/netbox_slm/__init__.py @@ -16,7 +16,7 @@ limitations under the License. from netbox.plugins import PluginConfig -__version__ = "1.9.0" +__version__ = "1.9.1" class SLMConfig(PluginConfig): diff --git a/netbox_slm/forms/software_license.py b/netbox_slm/forms/software_license.py index 4cf7e34..4ab14f4 100644 --- a/netbox_slm/forms/software_license.py +++ b/netbox_slm/forms/software_license.py @@ -24,6 +24,29 @@ from utilities.forms.widgets import APISelect, DatePicker class SoftwareLicenseForm(NetBoxModelForm): comments = CommentField() + fieldsets = ( + FieldSet( + "name", + "description", + "software_product", + "version", + "installation", + name="Software License", + ), + FieldSet("tenant_group", "tenant", name="Tenancy"), + FieldSet( + "type", + "spdx_expression", + "stored_location", + "stored_location_url", + "start_date", + "expiration_date", + "support", + "license_amount", + name="License Details", + ), + FieldSet("tags", name="Tags"), + ) spdx_expression = ChoiceField(required=False, choices=spdx_license_names(), label="SPDX expression") stored_location_url = LaxURLField(required=False) diff --git a/netbox_slm/tests/test_models.py b/netbox_slm/tests/test_models.py index 4614930..e8d3fc5 100644 --- a/netbox_slm/tests/test_models.py +++ b/netbox_slm/tests/test_models.py @@ -1,4 +1,5 @@ from django.core.exceptions import ValidationError +from netbox_slm.forms import SoftwareLicenseForm from tenancy.models import Tenant, TenantGroup from .base import SlmBaseTestCase @@ -64,6 +65,14 @@ class ModelTestCase(SlmBaseTestCase): self.assertEqual(self.tenant_group, self.software_license.tenant_group) self.assertEqual(self.tenant, self.software_license.tenant) + def test_software_license_form_renders_tenancy_fields(self): + form = SoftwareLicenseForm(instance=self.software_license) + self.assertIn("tenant_group", form.fields) + self.assertIn("tenant", form.fields) + self.assertTrue( + any("tenant_group" in fieldset.items and "tenant" in fieldset.items for fieldset in form.fieldsets) + ) + def test_software_license_rejects_tenant_from_other_group(self): other_group = TenantGroup.objects.create(name="other group", slug="other-group") other_tenant = Tenant.objects.create(name="other tenant", slug="other-tenant", group=other_group)