Verified Commit f6d610f8 authored by Adrian Schollmeyer's avatar Adrian Schollmeyer
Browse files

generator/generic-host: Handle missing configured platform

Sometimes, hosts don't have a platform configured in NetBox. This commit
handles this case properly by assuming those devices are not Linux
parent a6034333
...@@ -219,12 +219,13 @@ def create_icinga2_host_object_from_netbox(netbox, device_name): ...@@ -219,12 +219,13 @@ def create_icinga2_host_object_from_netbox(netbox, device_name):
continue continue
ssh_ports.append(p) ssh_ports.append(p)
device_platform = device.platform.slug
device_is_linux = False device_is_linux = False
for linux_platform in LINUX_PLATFORMS: if device.platform:
if device_platform == linux_platform: device_platform = device.platform.slug
device_is_linux = True for linux_platform in LINUX_PLATFORMS:
break if device_platform == linux_platform:
device_is_linux = True
if device_is_linux: if device_is_linux:
host = Icinga2Host( host = Icinga2Host(
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment