From 824263df5c21605413a03097ec799a7224e35fe4 Mon Sep 17 00:00:00 2001 From: "ricardo.bartels@telekom.de" Date: Wed, 24 Jan 2024 22:17:04 +0100 Subject: [PATCH] fixes issue with wrongly assign 'assigned_object_type' to not associated IP address #361 --- module/netbox/object_classes.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/module/netbox/object_classes.py b/module/netbox/object_classes.py index 03f92b5..08f5249 100644 --- a/module/netbox/object_classes.py +++ b/module/netbox/object_classes.py @@ -1734,6 +1734,11 @@ def update(self, data=None, read_from_netbox=False, source=None): if "assigned_object_id" in self.updated_items: self.updated_items.append("assigned_object_type") + # if ip association has been removed we also need to get rid of object type + if "assigned_object_type" in self.updated_items and self.data.get("assigned_object_id") is None \ + and "assigned_object_type" in self.updated_items: + self.updated_items.remove("assigned_object_type") + if assigned_object is None or previous_ip_device_vm is None: return