Skip to content

Commit 21bd7f4

Browse files
authored
Merge pull request #393 from MajesticFalcon/vm_init_bug
Bugfix - Allow primary device IP without virtual machine initialization
2 parents 3758bc8 + 385c66e commit 21bd7f4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

startup_scripts/270_primary_ips.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ def link_primary_ip(assets, asset_model):
3131
devices = load_yaml('/opt/netbox/initializers/devices.yml')
3232
virtual_machines = load_yaml('/opt/netbox/initializers/virtual_machines.yml')
3333

34-
if devices is None and virtual_machines is None:
35-
sys.exit()
36-
3734
optional_assocs = {
3835
'primary_ip4': (IPAddress, 'address'),
3936
'primary_ip6': (IPAddress, 'address')
4037
}
4138

42-
link_primary_ip(devices, Device)
43-
link_primary_ip(virtual_machines, VirtualMachine)
39+
if devices is None and virtual_machines is None:
40+
sys.exit()
41+
if devices is not None:
42+
link_primary_ip(devices, Device)
43+
if virtual_machines is not None:
44+
link_primary_ip(virtual_machines, VirtualMachine)

0 commit comments

Comments
 (0)