From 00f820ad90856654febf1659fc087af389ee8f2c Mon Sep 17 00:00:00 2001 From: Per Toft Date: Wed, 26 Feb 2025 09:18:01 +0000 Subject: [PATCH] Introcuded an option to disable physical nic updates in Netbox --- module/sources/vmware/config.py | 6 ++++++ module/sources/vmware/connection.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/module/sources/vmware/config.py b/module/sources/vmware/config.py index 2dc58abf..fdb9b39b 100644 --- a/module/sources/vmware/config.py +++ b/module/sources/vmware/config.py @@ -382,6 +382,12 @@ def __init__(self): The same behavior also applies for VM disk sizes.""", default_value=True ), + ConfigOption("skip_host_nics", + bool, + description="""Skip creating or updating host physical nics in Netobx. Normal operation + will maintain all phisical nics in netbox. This option will skip this part.""" , + default_value=False + ), # removed settings ConfigOption("netbox_host_device_role", diff --git a/module/sources/vmware/connection.py b/module/sources/vmware/connection.py index f8f8bfd8..7b479511 100644 --- a/module/sources/vmware/connection.py +++ b/module/sources/vmware/connection.py @@ -1694,6 +1694,9 @@ def add_host(self, obj): if len(host_custom_fields) > 0: host_data["custom_fields"] = host_custom_fields + if self.settings.skip_host_nics is True: + return + # iterate over hosts virtual switches, needed to enrich data on physical interfaces self.network_data["vswitch"][name] = dict() for vswitch in grab(obj, "config.network.vswitch", fallback=list()):