diff --git a/netbox_interface_sync/comparison.py b/netbox_interface_sync/comparison.py index 41d420c..ec0ce61 100644 --- a/netbox_interface_sync/comparison.py +++ b/netbox_interface_sync/comparison.py @@ -146,6 +146,10 @@ class PowerPortComparison(ParentTypedComparison): and (self.allocated_draw == other.allocated_draw) ) + def __hash__(self): + # Ignore some fields when hashing; ignore interface name case and whitespaces + return hash((self.name.lower().replace(" ", ""), self.type)) + @dataclass(frozen=True) class PowerOutletComparison(ParentTypedComparison): diff --git a/netbox_interface_sync/views.py b/netbox_interface_sync/views.py index 59ff5aa..6c0b03a 100644 --- a/netbox_interface_sync/views.py +++ b/netbox_interface_sync/views.py @@ -317,7 +317,7 @@ class PowerOutletComparisonView(LoginRequiredMixin, PermissionRequiredMixin, Vie except ValueError: pass else: - message.append("Dependecy detected, sync power ports first!") + messages.error(request, "Dependecy detected, sync power ports first!") if created > 0: message.append(f"created {created} power outlet") @@ -450,7 +450,7 @@ class FrontPortComparisonView(LoginRequiredMixin, PermissionRequiredMixin, View) except ValueError: pass else: - message.append("Dependecy detected, sync rear ports first!") + messages.error(request, "Dependecy detected, sync power ports first!") if created > 0: message.append(f"created {created} front ports")