mirror of
https://github.com/bb-Ricardo/netbox-sync.git
synced 2026-04-30 22:44:07 -05:00
fixes issue with dcim/interface type if parent interface is designed #332
This commit is contained in:
@@ -1606,7 +1606,8 @@ class NBInterface(NetBoxObject):
|
||||
"tagged_vlans": NBVLANList,
|
||||
"description": 200,
|
||||
"connection_status": bool,
|
||||
"tags": NBTagList
|
||||
"tags": NBTagList,
|
||||
"parent": object
|
||||
}
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@@ -1619,6 +1620,16 @@ class NBInterface(NetBoxObject):
|
||||
|
||||
return result_list
|
||||
|
||||
def update(self, data=None, read_from_netbox=False, source=None):
|
||||
|
||||
# remove definition of interface type if a parent interface is set as it only supports virtual types
|
||||
if grab(self, "data.parent") is not None and data.get("type") is not None:
|
||||
log.debug2(f"{self.name} '{self.get_display_name()}' attribute 'parent' is set. "
|
||||
f"Removing type {data.get('type')} from update request")
|
||||
del data["type"]
|
||||
|
||||
super().update(data=data, read_from_netbox=read_from_netbox, source=source)
|
||||
|
||||
|
||||
class NBIPAddress(NetBoxObject):
|
||||
name = "IP address"
|
||||
|
||||
Reference in New Issue
Block a user