Added basic error message when Netbox details are invalid. Fixed logging message for when template context keys are not present.

This commit is contained in:
TheNetworkGuy
2024-11-06 15:57:11 +01:00
parent ffc2aa1947
commit 56c19d97de
2 changed files with 13 additions and 3 deletions

View File

@@ -146,11 +146,11 @@ class PhysicalDevice():
""" Get Zabbix templates from the device context """
if "zabbix" not in self.config_context:
e = (f"Host {self.name}: Key 'zabbix' not found in config "
"context for template")
"context for template lookup")
raise TemplateError(e)
if "templates" not in self.config_context["zabbix"]:
e = (f"Host {self.name}: Key 'templates' not found in config "
"context 'zabbix' for template host")
"context 'zabbix' for template lookup")
raise TemplateError(e)
return self.config_context["zabbix"]["templates"]