From f120d33e0029a3b3df853f8694de3a6a81147099 Mon Sep 17 00:00:00 2001 From: Domisiding Date: Wed, 12 Apr 2023 18:02:21 +0200 Subject: [PATCH] Fix Merge conflict --- netbox_zabbix_sync.py | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/netbox_zabbix_sync.py b/netbox_zabbix_sync.py index c2bfc79..96ed59a 100755 --- a/netbox_zabbix_sync.py +++ b/netbox_zabbix_sync.py @@ -220,22 +220,15 @@ class NetworkDevice(): # Gather device Zabbix templates device_type_cf = self.nb.device_type.custom_fields - if(templates_config_context): - try: - self.zbx_templates = self.config_context["zabbix"]["templates"] - except KeyError: - e = "Config context for Zabbix template was not found for host {self.name}" - logger.error(e) + if(template_cf in device_type_cf): + self.template_name = device_type_cf[template_cf] + self.zbx_templates = [device_type_cf[template_cf]] else: - if(template_cf in device_type_cf): - self.template_name = device_type_cf[template_cf] - self.zbx_templates = [device_type_cf[template_cf]] - else: - e = (f"Custom field {template_cf} not " - f"found for {self.nb.device_type.manufacturer.name}" - f" - {self.nb.device_type.display}.") - logger.warning(e) - raise SyncInventoryError(e) + e = (f"Custom field {template_cf} not " + f"found for {self.nb.device_type.manufacturer.name}" + f" - {self.nb.device_type.display}.") + logger.warning(e) + raise SyncInventoryError(e) def set_hostgroup(self, format): """Set the hostgroup for this device"""