[BUG]: zabbix_template.present results in an error: Incorrect API "templatescreen"
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
I want to create a new template in zabbix with the zabbix_template.present state. Copying and running a simplified example results in an error.
Setup
# cat zabix/create_template.sls
zabbix-template-present:
zabbix_template.present:
- name: Testing Template
# Do not touch existing assigned hosts
# True will detach all other hosts than defined here
- static_host_list: False
- params:
description: Test Template
groups:
# groups must already exist
# template must be at least in one hostgroup
- groupid:
query_object: hostgroup
query_name: Templates
and running this state results in:
# salt 'myhost' state.apply zabbix.create_template debug=true
myhost:
----------
ID: zabbix-template-present
Function: zabbix_template.present
Name: Testing Template
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/salt/state.py", line 2154, in call
*cdata["args"], **cdata["kwargs"]
File "/usr/lib/python3.7/site-packages/salt/loader.py", line 2087, in wrapper
return f(*args, **kwargs)
File "/usr/lib64/python3.7/site-packages/salt/states/zabbix_template.py", line 798, in present
component, template_id, **kwargs
File "/usr/lib64/python3.7/site-packages/salt/states/zabbix_template.py", line 329, in _get_existing_template_c_list
c_def["qtype"] + ".get", q_params, **kwargs
File "/usr/lib64/python3.7/site-packages/salt/modules/zabbix.py", line 2558, in run_query
ret = _query(method, params, conn_args["url"], conn_args["auth"])
File "/usr/lib64/python3.7/site-packages/salt/modules/zabbix.py", line 187, in _query
ret["error"]["message"], ret["error"]["data"]
salt.exceptions.SaltException: Zabbix API: Invalid params. (Incorrect API "templatescreen".)
Steps to Reproduce the behavior
Zabbix 5.2
setup this state and run it.
Expected behavior
Should create the template without throwing an error.
Screenshots
Debug output see above.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) # salt --versions-report
Salt Version:
Salt: 3001.6
Dependency Versions:
cffi: 1.14.0
cherrypy: Not Installed
dateutil: 2.8.1
docker-py: Not Installed
gitdb: 4.0.5
gitpython: 3.1.8
Jinja2: 2.11.2
libgit2: 1.0.1
M2Crypto: 0.36.0
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 1.0.0
mysql-python: Not Installed
pycparser: 2.20
pycrypto: 3.9.8
pycryptodome: 3.9.8
pygit2: 1.3.0
Python: 3.7.9 (default, Nov 3 2020, 12:10:17)
python-gnupg: 0.4.6
PyYAML: 5.3.1
PyZMQ: 19.0.1
smmap: 3.0.4
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.3
System Versions:
dist: gentoo 2.7
locale: UTF-8
machine: x86_64
release: 4.9.74-grsecurity
system: Linux
version: Gentoo 2.7
Additional context
Add any other context about the problem here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in salt/states/zabbix_template.py at _get_existing_template_c_list and follow its call into salt/modules/zabbix.py, especially run_query. Reproduce the state against Zabbix 5.2 using the supplied example and verify that the template is created without the Incorrect API "templatescreen" error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100