From 340f404f94b7337662a58e6ef26bb2c2753e40e4 Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 4 Nov 2026 08:41:24 +0100 Subject: [PATCH] fix: allow equal interface names on different stack member devices Co-Authored-By: Claude Opus 5.5 --- netbox_sync/ui/dialogs.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/netbox_sync/ui/dialogs.py b/netbox_sync/ui/dialogs.py index faf5427..a2271e7 100644 --- a/netbox_sync/ui/dialogs.py +++ b/netbox_sync/ui/dialogs.py @@ -976,12 +976,14 @@ class SwitchMappingDialog(_Dialog): chosen = combo.currentData() target = "" if chosen == self.NEW else chosen mapping = result[switch["id"]]["interface_map"] - if target and (switch["id"], target) in used: + # Stack members have their own devices, so equal names are only a clash on the same device. + key = (switch["id"], item.get("owner_id"), target) + if target and key in used: self.show_error(f"{switch['name']}: „{target}“ ist mehreren Schnittstellen zugeordnet " - f"({used[(switch['id'], target)]}, {item['name']}).") + f"({used[key]}, {item['name']}).") return if target: - used[(switch["id"], target)] = item["name"] + used[key] = item["name"] # Plain name matches stay automatic; everything else is remembered. if item["method"] == "name" and target == item["netbox_name"]: mapping.pop(item["name"], None)