feat: license export compatible with NetBox-SLM

When the netbox_slm plugin is installed, the "Lizenzen" section reads
its SoftwareLicense objects automatically:

- Scope matching via installations on devices, VMs or clusters in the
  exported site/location/tenant, plus licenses assigned to the tenant
  and tenant-less licenses of its tenant group (incl. parent groups) or,
  for tenant group exports, of the group and its subgroups.
- One table per manufacturer: license, product/version, type, amount,
  validity incl. renewal interval, status (active, expires in N days,
  expired, lifetime), support, installation target and tenant.
- License keys only with the "include secrets" option.
- Other configured license_sources keep working alongside.

Table cells in HTML/PDF now preserve line breaks.

Bump version to 0.9.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-24 15:26:45 +02:00
co-authored by Claude Opus 5.5
parent 0cd72824d5
commit 0aa9403cb9
6 changed files with 152 additions and 6 deletions
+7 -2
View File
@@ -402,11 +402,16 @@ DEFAULT_LICENSE_SOURCES = [
]
@section("licenses", "Lizenzen", "Verträge & Lizenzen", hint="Aus Lizenz-Plugin (z.B. netbox-lifecycle)")
@section("licenses", "Lizenzen", "Verträge & Lizenzen", hint="Aus NetBox-SLM oder anderem Lizenz-Plugin")
def licenses(scope, opts):
from . import licenses_slm
sources = get_plugin_config("netbox_customer_export", "license_sources") or DEFAULT_LICENSE_SOURCES
blocks = [H(1, "Lizenzen")]
found_source = False
if licenses_slm.is_installed():
found_source = True
blocks += licenses_slm.slm_blocks(scope, opts)
for src in sources:
try:
model = apps.get_model(src["model"])
@@ -423,7 +428,7 @@ def licenses(scope, opts):
cols = src["columns"]
blocks.append(T([c[0] for c in cols], [[get(o, c[1]) for c in cols] for o in qs]))
if not found_source:
return _empty(opts, blocks, "Kein Lizenz-Plugin installiert (z.B. netbox-lifecycle) – siehe README.")
return _empty(opts, blocks, "Kein Lizenz-Plugin installiert (NetBox-SLM oder netbox-lifecycle) – siehe README.")
return blocks if len(blocks) > 1 else _empty(opts, blocks)