From d4c7f0afa214f72ae444034ad84fa1cf2dad0390 Mon Sep 17 00:00:00 2001 From: miksonx Date: Tue, 3 Sep 2024 21:18:35 +0200 Subject: [PATCH] Fixed version compatibility for zabbix 7.0 proxy get by name --- plugins/modules/zabbix_action.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/modules/zabbix_action.py b/plugins/modules/zabbix_action.py index c0123ae1f..c5f238d0c 100644 --- a/plugins/modules/zabbix_action.py +++ b/plugins/modules/zabbix_action.py @@ -1013,9 +1013,13 @@ def get_proxy_by_proxy_name(self, proxy_name): """ try: + if LooseVersion(self._zbx_api_version) >= LooseVersion('7.0'): + filter = {'name': [proxy_name]} + else: + filter = {'host': [proxy_name]} proxy_list = self._zapi.proxy.get({ "output": "extend", - "filter": {"host": [proxy_name]} + "filter": filter, }) if len(proxy_list) < 1: self._module.fail_json(msg="Proxy not found: %s" % proxy_name)