From 703be259fd58542f52cdd9da44f91ebde3b77bf2 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 6 Dec 2018 16:32:42 -0500 Subject: [PATCH] Normalize connection_status for non-connected device components during migration --- netbox/dcim/migrations/0066_cables.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/netbox/dcim/migrations/0066_cables.py b/netbox/dcim/migrations/0066_cables.py index 9b4cc7152..253167392 100644 --- a/netbox/dcim/migrations/0066_cables.py +++ b/netbox/dcim/migrations/0066_cables.py @@ -46,6 +46,9 @@ def console_connections_to_cables(apps, schema_editor): if 'test' not in sys.argv: print("{} cables created".format(cable_count)) + # Normalize connection_status for all non-connected ConsolePorts + ConsolePort.objects.filter(connected_endpoint__isnull=True).update(connection_status=None) + def power_connections_to_cables(apps, schema_editor): """ @@ -87,6 +90,9 @@ def power_connections_to_cables(apps, schema_editor): if 'test' not in sys.argv: print("{} cables created".format(cable_count)) + # Normalize connection_status for all non-connected PowerPorts + PowerPort.objects.filter(connected_endpoint__isnull=True).update(connection_status=None) + def interface_connections_to_cables(apps, schema_editor): """