From 2094799a5105bfe0b589ff5bf0131f448b4aa0c0 Mon Sep 17 00:00:00 2001 From: Raymond Kuiper Date: Wed, 24 Jul 2024 10:58:22 +0200 Subject: [PATCH 1/3] Allow for NetBox Config Context to have a null value for proxy. --- modules/device.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/device.py b/modules/device.py index 5b16419..265e7d8 100644 --- a/modules/device.py +++ b/modules/device.py @@ -371,11 +371,14 @@ class NetworkDevice(): Sets proxy or proxy group if this value has been defined in config context - input: List of all proxies and proxy gorups in standardized format + input: List of all proxies and proxy groups in standardized format """ # check if the key Zabbix is defined in the config context if not "zabbix" in self.nb.config_context: return False + elif ("proxy" in self.nb.config_context["zabbix"] and + not self.nb.config_context["zabbix"]["proxy"]): + return False # Proxy group takes priority over a proxy due # to it being HA and therefore being more reliable # Includes proxy group fix since Zabbix <= 6 should ignore this From 07049ea6d864aa7e992bf54f8a40e22526607c3d Mon Sep 17 00:00:00 2001 From: Raymond Kuiper Date: Wed, 24 Jul 2024 11:05:35 +0200 Subject: [PATCH 2/3] Adjustment from linting suggestion --- modules/device.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/device.py b/modules/device.py index 265e7d8..1947cbd 100644 --- a/modules/device.py +++ b/modules/device.py @@ -376,7 +376,7 @@ class NetworkDevice(): # check if the key Zabbix is defined in the config context if not "zabbix" in self.nb.config_context: return False - elif ("proxy" in self.nb.config_context["zabbix"] and + if ("proxy" in self.nb.config_context["zabbix"] and not self.nb.config_context["zabbix"]["proxy"]): return False # Proxy group takes priority over a proxy due From da4fec6bf188ed592cee9b33b1dd11c98216f4b4 Mon Sep 17 00:00:00 2001 From: Raymond Kuiper Date: Wed, 24 Jul 2024 11:06:50 +0200 Subject: [PATCH 3/3] Removed trailing whitespace --- modules/device.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/device.py b/modules/device.py index 1947cbd..583d6fe 100644 --- a/modules/device.py +++ b/modules/device.py @@ -376,7 +376,7 @@ class NetworkDevice(): # check if the key Zabbix is defined in the config context if not "zabbix" in self.nb.config_context: return False - if ("proxy" in self.nb.config_context["zabbix"] and + if ("proxy" in self.nb.config_context["zabbix"] and not self.nb.config_context["zabbix"]["proxy"]): return False # Proxy group takes priority over a proxy due