Add state modules for Zabbix templates, actions and valuemaps - #47398
Conversation
|
@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. |
| 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}' |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Sorry, my mistake. Will fix it in next commit.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
You are right, it was a typo. Please, see my last commit where it is fixed.
Merge branch 'zabbix_template_state' of https://github.com/slivik/salt into zabbix_template_state
|
|
||
|
|
||
| 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): |
There was a problem hiding this comment.
Should this still be ip_ and if_type?
There was a problem hiding this comment.
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.
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