From 89e39012172d871c2951332586c996560b3f234d 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 --- .../fix-zabbix-actions-proxy-get-name-compatibility-v7.yml | 2 ++ plugins/modules/zabbix_action.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/fix-zabbix-actions-proxy-get-name-compatibility-v7.yml diff --git a/changelogs/fragments/fix-zabbix-actions-proxy-get-name-compatibility-v7.yml b/changelogs/fragments/fix-zabbix-actions-proxy-get-name-compatibility-v7.yml new file mode 100644 index 000000000..21784314b --- /dev/null +++ b/changelogs/fragments/fix-zabbix-actions-proxy-get-name-compatibility-v7.yml @@ -0,0 +1,2 @@ +bugfixes: + - zabbix_actions - fix proxy get compatibility for zabbix 7.0 \ No newline at end of file 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)