mirror of
https://github.com/TheNetworkGuy/netbox-zabbix-sync.git
synced 2025-07-13 15:24:48 -06:00
feat: support overridable template contexts using dictionaries
This commit is contained in:
parent
908e7eeda9
commit
4a4919053f
@ -156,9 +156,15 @@ class PhysicalDevice():
|
||||
e = (f"Host {self.name}: Key 'templates' not found in config "
|
||||
"context 'zabbix' for template lookup")
|
||||
raise TemplateError(e)
|
||||
# Check if format is list or string.
|
||||
# Check if format is list, dictionary or string.
|
||||
if isinstance(self.config_context["zabbix"]["templates"], str):
|
||||
return [self.config_context["zabbix"]["templates"]]
|
||||
elif isinstance(self.config_context["zabbix"]["templates"], dict):
|
||||
return [
|
||||
template
|
||||
for template, enabled in self.config_context["zabbix"]["templates"].items()
|
||||
if enabled
|
||||
]
|
||||
return self.config_context["zabbix"]["templates"]
|
||||
|
||||
def set_inventory(self, nbdevice):
|
||||
|
Loading…
Reference in New Issue
Block a user