Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add state modules for Zabbix templates, actions and valuemaps #47398

Merged
merged 5 commits into from May 8, 2018

Conversation

slivik
Copy link
Contributor

@slivik slivik commented Apr 30, 2018

What does this PR do?

Adds functions to existing Zabbix module, test and docs related to newly added state modules for Zabbix templates, actions and value maps.

What issues does this PR fix or reference?

None

Tests written?

Yes

Commits signed with GPG?

Yes

@cachedout
Copy link
Contributor

@jirikotlin Can you look some of this over? I know you've done a lot of work in this area.

'''
.. versionadded:: 2017.7

Imports Zabbix configuration sepcified in file to Zabbix server.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling: specified

@@ -846,8 +1070,8 @@ def host_create(host, groups, interfaces, **connection_args):
.. code-block:: bash

salt '*' zabbix.host_create technicalname 4
interfaces='{type: 1, main: 1, useip: 1, ip: "192.168.3.1", dns: "", port: 10050}'
visible_name='Host Visible Name' inventory_mode=0 inventory='{"alias": "something"}'
interfaces='{if_type: 1, main: 1, useip: 1, ip_: "192.168.3.1", dns: "", port: 10050}'
Copy link
Contributor

@mchugh19 mchugh19 Apr 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the gain from the change in user facing syntax? Does this require updates to the zabbix_host state? This line also clobbers an example of setting inventory information.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my mistake. Will fix it in next commit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Zabbix API uses the following for interfaces in host.create:

"interfaces": [
            {
                "type": 1,
                "main": 1,
                "useip": 1,
                "ip": "192.168.3.1",
                "dns": "",
                "port": "10050"
            }
        ]

Why the change to if_type and ip_? This will affect user configurations and existing states, so is the rename necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, it was a typo. Please, see my last commit where it is fixed.

slivik added 2 commits May 2, 2018 09:44
Merge branch 'zabbix_template_state' of https://github.com/slivik/salt into zabbix_template_state
@@ -1466,7 +1689,7 @@ def hostinterface_get(hostids, **connection_args):
return ret


def hostinterface_create(hostid, ip, dns='', main=1, type=1, useip=1, port=None, **connection_args):
def hostinterface_create(hostid, ip_, dns='', main=1, if_type=1, useip=1, port=None, **connection_args):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this still be ip_ and if_type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in this case it is correct since Salt coding style (and pylint) says at least three characters for variable name and "type" is reserved Python keyword.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants