saltstack / saltstack/salt

[BUG]: zabbix.py zabbix.configuration_import: API signals Invalid Parameter when importing simple template

Open
#60,562 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug salt-extensions
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
Trying to import a skeleton template results in an error from the Zabbix API: Invalid parameter "/rules": unexpected parameter "templateScreens".

Setup
Simpe test setup.

Create template:
  module.run:
    - name: zabbix.configuration_import
    - config_file: salt://zabbix/templates/testtempl.xml

with the template

<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
    <version>5.2</version>
    <date>2021-07-17T14:05:58Z</date>
    <groups>
        <group>
            <name>Templates</name>
        </group>
    </groups>
    <templates>
        <template>
            <template>Testtemplate</template>
            <name>Testtemplate</name>
            <groups>
                <group>
                    <name>Templates</name>
                </group>
            </groups>
        </template>
    </templates>
</zabbix_export>

Steps to Reproduce the behavior
setup state and apply.

Expected behavior
Should create the (empty) template in zabbix.

Screenshots
What really happens:

          ID: Create template
    Function: module.run
        Name: zabbix.configuration_import
      Result: False
     Comment: Module function zabbix.configuration_import executed
     Started: 16:35:08.022902
    Duration: 823.316 ms
     Changes:   
              ----------
              ret:
                  ----------
                  message:
                      Zabbix API: Invalid params. (Invalid parameter "/rules": unexpected parameter "templateScreens".)
                  name:
                      salt://zabbix/templates/testtempl.xml
                  result:
                      False

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in zabbix.py at the zabbix.configuration_import entry point and reproduce the import using the XML template shown against the Zabbix API. Trace how the import produces the rules payload, focusing on the unexpected templateScreens parameter. Done means the empty template is created successfully without the Invalid params error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.