feat: optionally maintain agent client software as netbox-slm installations
New option "Installierte Software in netbox-slm pflegen" in the client transfer dialog (off by default, remembered per profile). For clients scanned with the NetBox Windows Agent, missing manufacturers, software products, versions and installations are created in the netbox-slm plugin; automatic installations the agent no longer reports are removed, installations entered by hand stay. Products that netbox-utilities created without a manufacturer get one. Names, versions and the marker comment match the software transfer of netbox-utilities, so both run side by side without duplicates and its client software overview shows the result. Without netbox-slm the option is skipped with a log message. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
4b8ab882f0
commit
c4c35ed8d4
8 files changed
+426
-5
No files matched your search
@@ -775,7 +775,8 @@ class Actions:
|
||||
choice = dialog.result
|
||||
self.state.update_client_options(
|
||||
netbox_site=choice["site_id"], netbox_role=choice["role_name"], netbox_tenant=choice["tenant_id"],
|
||||
sync_interfaces=choice["interfaces"], update_existing=choice["update_existing"])
|
||||
sync_interfaces=choice["interfaces"], update_existing=choice["update_existing"],
|
||||
sync_software=choice["software"])
|
||||
self._preview_clients(engine, rows, choice)
|
||||
QTimer.singleShot(0, ask)
|
||||
|
||||
@@ -786,7 +787,7 @@ class Actions:
|
||||
def _run_client_sync(engine, rows, choice, ctx, dry_run, role_id=None):
|
||||
return engine.sync(rows, choice["site_id"], role_id or choice["role_id"], choice["tenant_id"],
|
||||
choice["interfaces"], choice["update_existing"], dry_run=dry_run,
|
||||
progress=ctx.progress, cancelled=lambda: ctx.cancelled)
|
||||
progress=ctx.progress, cancelled=lambda: ctx.cancelled, software=choice.get("software", False))
|
||||
|
||||
def _preview_clients(self, engine, rows, choice):
|
||||
def show(report):
|
||||
@@ -812,7 +813,10 @@ class Actions:
|
||||
text = (f"{report['devices_created']} Geräte angelegt, {report['devices_updated']} aktualisiert, "
|
||||
f"{report['interfaces_created']} Schnittstellen, {report['ips_created']} IP-Adressen"
|
||||
+ (f", {report['assets_created']} Assets angelegt, {report['assets_updated']} aktualisiert"
|
||||
if report.get("assets_created") or report.get("assets_updated") else ""))
|
||||
if report.get("assets_created") or report.get("assets_updated") else "")
|
||||
+ (f", {report['software_installed']} Software-Installationen angelegt, "
|
||||
f"{report['software_removed']} entfernt"
|
||||
if report.get("software_installed") or report.get("software_removed") else ""))
|
||||
area_log("client")(f"Client-Übertragung: {text}", "success")
|
||||
if report["errors"]:
|
||||
widgets.message(self.window, "Mit Problemen abgeschlossen", text + ".", "warning",
|
||||
|
||||
@@ -115,8 +115,17 @@ class ClientTargetDialog(_Dialog):
|
||||
"unverändert.")
|
||||
self.update_existing = checkbox("Vorhandene Geräte aktualisieren (Modell, Plattform, Seriennummer)",
|
||||
options.get("update_existing", True))
|
||||
self.software = checkbox("Installierte Software in netbox-slm pflegen (nur Agent-Clients)",
|
||||
options.get("sync_software", False),
|
||||
tooltip="Legt für die vom NetBox Windows Agent gemeldete Software fehlende "
|
||||
"Hersteller, Softwareprodukte, Versionen und Installationen im Plugin "
|
||||
"netbox-slm an und entfernt automatisch angelegte Installationen, die "
|
||||
"nicht mehr gemeldet werden. Von Hand erfasste Installationen bleiben "
|
||||
"unverändert. Die Client-Software-Übersicht von netbox-utilities zeigt "
|
||||
"diese Daten an.")
|
||||
self.root.addWidget(self.interfaces)
|
||||
self.root.addWidget(self.update_existing)
|
||||
self.root.addWidget(self.software)
|
||||
self.root.addWidget(label("Zuordnung über den Gerätenamen (ohne Groß-/Kleinschreibung). Standort und Rolle "
|
||||
"vorhandener Geräte bleiben unverändert.", muted=True, wrap=True))
|
||||
self.root.addWidget(self.error_banner)
|
||||
@@ -144,6 +153,7 @@ class ClientTargetDialog(_Dialog):
|
||||
"site_id": site, "role_id": role, "role_name": role_text,
|
||||
"tenant_id": tenant,
|
||||
"interfaces": self.interfaces.isChecked(), "update_existing": self.update_existing.isChecked(),
|
||||
"software": self.software.isChecked(),
|
||||
}
|
||||
super().accept()
|
||||
|
||||
@@ -166,6 +176,9 @@ class ClientPreviewDialog(_Dialog):
|
||||
assets = report.get("assets_created", 0) + report.get("assets_updated", 0)
|
||||
if assets:
|
||||
items.append((f"{assets} Assets", "info"))
|
||||
software = report.get("software_installed", 0) + report.get("software_removed", 0)
|
||||
if software:
|
||||
items.append((f"{software} Software-Installationen", "info"))
|
||||
if report["errors"]:
|
||||
items.append((f"{len(report['errors'])} Probleme", "error"))
|
||||
for text, kind in items:
|
||||
|
||||
Reference in new issue
Block a user