Merge branch 'feature/strip-domain-from-name' into development

This commit is contained in:
Ricardo Bartels
2021-02-26 17:41:29 +01:00
2 changed files with 18 additions and 3 deletions

View File

@@ -74,7 +74,9 @@ class VMWareHandler:
"custom_dns_servers": None,
"set_primary_ip": "when-undefined",
"skip_vm_comments": False,
"skip_vm_templates": True
"skip_vm_templates": True,
"strip_host_domain_name": False,
"strip_vm_domain_name": False
}
init_successful = False
@@ -1377,6 +1379,9 @@ class VMWareHandler:
name = get_string_or_none(grab(obj, "name"))
if name is not None and self.strip_host_domain_name is True:
name = name.split(".")[0]
# parse data
log.debug2(f"Parsing vCenter host: {name}")
@@ -1451,7 +1456,8 @@ class VMWareHandler:
product_version = get_string_or_none(grab(obj, "summary.config.product.version"))
platform = f"{product_name} {product_version}"
# if the device vendor/model cannot be retrieved (due to problem on the host), set a dummy value so the host still gets synced
# if the device vendor/model cannot be retrieved (due to problem on the host),
# set a dummy value so the host still gets synced
if manufacturer is None:
manufacturer = "Generic Vendor"
if model is None:
@@ -1859,6 +1865,9 @@ class VMWareHandler:
name = get_string_or_none(grab(obj, "name"))
if name is not None and self.strip_vm_domain_name is True:
name = name.split(".")[0]
#
# Filtering
#

View File

@@ -189,9 +189,15 @@ permitted_subnets = 172.16.0.0/12, 10.0.0.0/8, 192.168.0.0/16, fd00::/8
#set_primary_ip = when-undefined
# Do not sync notes from a VM in vCenter to the comments field on a VM in netbox
# skip_vm_comments = False
#skip_vm_comments = False
# Do not sync template VMs
#skip_vm_templates = True
# strip domain part from host name before syncing device to NetBox
#strip_host_domain_name = False
# strip domain part from VM name before syncing VM to NetBox
#strip_vm_domain_name = False
# EOF