saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.13k stars 5.47k forks source link

[BUG] Zabbix 6.2 - host.update: Invalid parameter "/selectParentTemplates": value must be one of "extend", "count". #62335

Open PacGyver opened 2 years ago

PacGyver commented 2 years ago

Description Updating host assigned zabbix templates through event -> reactor -> orchestration

Setup salt-minion 3004.1 Zabbix-Server 6.2

Steps to Reproduce the behavior state.apply

Expected behavior Templates empty

Versions Report

Salt Version: Salt: 3004.1 Dependency Versions: cffi: 1.14.6 cherrypy: unknown dateutil: 2.8.1 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 2.11.3 libgit2: 1.1.0 M2Crypto: Not Installed Mako: Not Installed msgpack: 1.0.2 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: 2.17 pycrypto: Not Installed pycryptodome: 3.9.8 pygit2: 1.6.1 Python: 3.7.13 (default, Mar 18 2022, 17:55:41) python-gnupg: 0.4.4 PyYAML: 5.4.1 PyZMQ: 18.0.1 smmap: Not Installed timelib: 0.2.4 Tornado: 4.5.3 ZMQ: 4.3.1 System Versions: dist: alpine 3.14.4 locale: UTF-8 machine: x86_64 release: 4.19.0-20-amd64 system: Linux version: Alpine Linux 3.14.4 ```yaml zabbix_host_assign_templates: zabbix_host.assign_templates: - host: {{ pillar['id'] }} - templates: - "Zabbix agent active" ```

Additional context Solution: /usr/lib/python3/dist-packages/salt/states/zabbix_host.py Change line 672

Is working again.

benfiedler commented 3 months ago

I think the response message from the API is a bit misleading. I encountered the exact same error on a zabbix 7.0 installation. I was able to fix with the simple change of just removing the outer quotes, i.e.

selectParentTemplates=["templateid"],

In the salt _QUERY log the params request then went from

{ "selectParentTemplates": "[\"templateid\"]" }

to:

{ "selectParentTemplates": ["templateid"] }

Which more closely matches the example request for Retrieving linked templates