mirror of
https://github.com/bb-Ricardo/netbox-sync.git
synced 2026-01-21 16:30:21 -06:00
Merge pull request #32 from gstorme/template
This commit is contained in:
@@ -73,7 +73,8 @@ class VMWareHandler:
|
||||
"dns_name_lookup": False,
|
||||
"custom_dns_servers": None,
|
||||
"set_primary_ip": "when-undefined",
|
||||
"skip_vm_comments": "False"
|
||||
"skip_vm_comments": False,
|
||||
"skip_vm_templates": True
|
||||
}
|
||||
|
||||
init_successful = False
|
||||
@@ -1866,6 +1867,12 @@ class VMWareHandler:
|
||||
# get VM power state
|
||||
status = "active" if get_string_or_none(grab(obj, "runtime.powerState")) == "poweredOn" else "offline"
|
||||
|
||||
# check if vm is template
|
||||
template = grab(obj, "config.template")
|
||||
if bool(self.skip_vm_templates) is True and template is True:
|
||||
log.debug2(f"VM '{name}' is a template. Skipping")
|
||||
return
|
||||
|
||||
# ignore offline VMs during first run
|
||||
if self.parsing_vms_the_first_time is True and status == "offline":
|
||||
log.debug2(f"Ignoring {status} VM '{name}' on first run")
|
||||
|
||||
@@ -191,4 +191,7 @@ permitted_subnets = 172.16.0.0/12, 10.0.0.0/8, 192.168.0.0/16, fd00::/8
|
||||
# Do not sync notes from a VM in vCenter to the comments field on a VM in netbox
|
||||
# skip_vm_comments = False
|
||||
|
||||
# Do not sync template VMs
|
||||
#skip_vm_templates = True
|
||||
|
||||
# EOF
|
||||
|
||||
Reference in New Issue
Block a user