From 1c0bd6f7887852b9401faae932d9a1b8320e3381 Mon Sep 17 00:00:00 2001 From: kkthxbye-code Date: Sat, 14 May 2022 12:17:22 +0200 Subject: [PATCH] Adopt child interfaces when adopting components --- netbox/dcim/models/devices.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/netbox/dcim/models/devices.py b/netbox/dcim/models/devices.py index e88af2d05..75c0c3034 100644 --- a/netbox/dcim/models/devices.py +++ b/netbox/dcim/models/devices.py @@ -1107,6 +1107,14 @@ class Module(NetBoxModel, ConfigContextModel): # Assign it to the module existing_item.module = self update_instances.append(existing_item) + + # Adopt child interfaces + if component_model is Interface: + for child_interface in existing_item.child_interfaces.filter(module__isnull=True): + child_interface.module = self + update_instances.append(child_interface) + + # If we adopted, skip creation continue # Only create new components if replication is enabled