fix: allow equal interface names on different stack member devices
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
f1af9f8f86
commit
340f404f94
1 file changed
+5
-3
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user