Merge pull request #393 from MajesticFalcon/vm_init_bug
Bugfix - Allow primary device IP without virtual machine initialization
This commit is contained in:
commit
21bd7f426c
@ -31,13 +31,14 @@ def link_primary_ip(assets, asset_model):
|
|||||||
devices = load_yaml('/opt/netbox/initializers/devices.yml')
|
devices = load_yaml('/opt/netbox/initializers/devices.yml')
|
||||||
virtual_machines = load_yaml('/opt/netbox/initializers/virtual_machines.yml')
|
virtual_machines = load_yaml('/opt/netbox/initializers/virtual_machines.yml')
|
||||||
|
|
||||||
if devices is None and virtual_machines is None:
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
optional_assocs = {
|
optional_assocs = {
|
||||||
'primary_ip4': (IPAddress, 'address'),
|
'primary_ip4': (IPAddress, 'address'),
|
||||||
'primary_ip6': (IPAddress, 'address')
|
'primary_ip6': (IPAddress, 'address')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if devices is None and virtual_machines is None:
|
||||||
|
sys.exit()
|
||||||
|
if devices is not None:
|
||||||
link_primary_ip(devices, Device)
|
link_primary_ip(devices, Device)
|
||||||
|
if virtual_machines is not None:
|
||||||
link_primary_ip(virtual_machines, VirtualMachine)
|
link_primary_ip(virtual_machines, VirtualMachine)
|
||||||
|
Loading…
Reference in New Issue
Block a user