mirror of
https://github.com/drygdryg/netbox-plugin-interface-sync
synced 2024-11-25 18:10:52 +03:00
FIxed a bug when correcting interfaces with the same name but different types
This commit is contained in:
parent
abce6c0b7c
commit
aa8dd795c4
@ -72,15 +72,15 @@ class InterfaceComparisonView(LoginRequiredMixin, PermissionRequiredMixin, View)
|
||||
map(int, filter(lambda x: x.isdigit(), request.POST.getlist("remove_from_device")))
|
||||
)
|
||||
|
||||
# Remove selected interfaces from the device and count them
|
||||
interfaces_deleted = Interface.objects.filter(id__in=remove_from_device).delete()[0]
|
||||
|
||||
# Add selected interfaces to the device and count them
|
||||
add_to_device_interfaces = InterfaceTemplate.objects.filter(id__in=add_to_device)
|
||||
interfaces_created = len(Interface.objects.bulk_create([
|
||||
Interface(device=device, name=i.name, type=i.type) for i in add_to_device_interfaces
|
||||
]))
|
||||
|
||||
# Remove selected interfaces from the device and count them
|
||||
interfaces_deleted = Interface.objects.filter(id__in=remove_from_device).delete()[0]
|
||||
|
||||
# Getting and validating a list of interfaces to rename
|
||||
fix_name_interfaces = filter(lambda i: str(i.id) in request.POST.getlist("fix_name"), interfaces)
|
||||
# Casting interface templates into UnifiedInterface objects for proper comparison with interfaces for renaming
|
||||
|
Loading…
Reference in New Issue
Block a user