mirror of
https://github.com/bb-Ricardo/netbox-sync.git
synced 2026-05-08 11:00:12 -05:00
added skipping_fhrp_group_ips config option to enable or disable fhrp group ip address overriding
This commit is contained in:
@@ -2137,12 +2137,18 @@ class NBIPAddress(NetBoxObject):
|
||||
super().resolve_relations()
|
||||
|
||||
def update(self, data=None, read_from_netbox=False, source=None):
|
||||
|
||||
object_type = data.get("assigned_object_type")
|
||||
assigned_object = data.get("assigned_object_id")
|
||||
|
||||
if object_type == "ipam.fhrpgroup":
|
||||
log.info(f"IP address with id '{assigned_object}' assigned to FHRP group. Skipping.")
|
||||
|
||||
# Skip IP assignments when the IP is assigned to FHRP groups when config option
|
||||
# skipping_fhrp_group_ips is set to True
|
||||
if source is not None:
|
||||
config_relation = source.get_object_relation(assigned_object, "skipping_fhrp_group_ips")
|
||||
if config_relation == True and object_type == "ipam.fhrpgroup":
|
||||
log.debug(f"IP address with id '{assigned_object}' assigned to FHRP group. Skipping.")
|
||||
return
|
||||
elif object_type == "ipam.fhrpgroup":
|
||||
log.debug(f"IP address with id '{assigned_object}' assigned to FHRP group. Skipping.")
|
||||
return
|
||||
|
||||
# used to track changes in object primary IP assignments
|
||||
|
||||
@@ -70,6 +70,12 @@ class CheckRedfishConfig(ConfigBase):
|
||||
via check_redfish if False only data which is not preset in NetBox will be added""",
|
||||
default_value=False),
|
||||
|
||||
ConfigOption("skipping_fhrp_group_ips",
|
||||
bool,
|
||||
description="""define if an IP address assigned to a FHRP group (like HSRP, VRRP, GLBP) will be skipped.
|
||||
If True this IP address will be skipped and not synced to NetBox to prevent incorrect syncing.""",
|
||||
default_value=False),
|
||||
|
||||
ConfigOption(**config_option_ip_tenant_inheritance_order_definition),
|
||||
]
|
||||
|
||||
|
||||
@@ -279,6 +279,11 @@ class VMWareConfig(ConfigBase):
|
||||
description="""If the VMware Site Recovery Manager is used to can skip syncing
|
||||
placeholder/replicated VMs from fail-over site to NetBox.""",
|
||||
default_value=False),
|
||||
ConfigOption("skipping_fhrp_group_ips",
|
||||
bool,
|
||||
description="""If an IP address is assigned to a FHRP group (like HSRP, VRRP, GLBP)
|
||||
then this IP address will be skipped and not synced to NetBox to prevent incorrect syncing.""",
|
||||
default_value=False),
|
||||
ConfigOption("strip_host_domain_name",
|
||||
bool,
|
||||
description="strip domain part from host name before syncing device to NetBox",
|
||||
|
||||
@@ -1010,6 +1010,12 @@ class VMWareHandler(SourceBase):
|
||||
"""
|
||||
|
||||
resolved_list = list()
|
||||
relation_data = grab(self.settings, relation, fallback=fallback)
|
||||
|
||||
if isinstance(relation_data, bool):
|
||||
log.debug(f"Object relation '{relation}' is boolean '{relation_data}'. Returning.")
|
||||
return relation_data
|
||||
|
||||
for single_relation in grab(self.settings, relation, fallback=list()):
|
||||
object_regex = single_relation.get("object_regex")
|
||||
match_found = False
|
||||
|
||||
Reference in New Issue
Block a user