zabbix_host module does not process additional host properties
Description of Issue
I try to create a new Zabbix host with saltstack.
The description of Zabbix_host.present stated this:
This function accepts all standard host properties: keyword argument names differ depending on your zabbix version, see:https://www.zabbix.com/documentation/2.4/manual/api/reference/host/object#host
I have added for example tls keywords to the Zabbix_host.present command in the sls file:
Setup
zabbix_create_host:
zabbix_host.present:
- host: {{ salt['grains.get']('nodename') }}
- groups:
- 20
- interfaces:
- default:
- ip: '0.0.0.0'
- dns: ''
- type: 'agent'
- port: '10050'
- inventory_mode: 1
- tls_connect: 2
- tls_accept: 2
- tls_psk_identity: PSK_{{ salt['grains.get']('nodename') }}
- tls_psk: {{ salt['pillar.get']('zabbix:psk') }}
Steps to Reproduce Issue
minion log file:
data: {"jsonrpc": "2.0", "params": {"interfaces": [{"ip": "0.0.0.0", "useip": "1", "dns": "", "main": "1", "type": "1", "port": "10050"}], "proxy_hostid": "0", "host": "<hostname>", "groups": [{"groupid": 20}], "inventory": {}}, "id": 0, "auth": "<auth_token>", "method": "host.create"}
Versions Report
All versions affected
Thank for letting us know
I've looked at the code and it ignores all properties other than host, groups, interfaces, inventory, and proxy_host. Even the documented visible_name is ignored.
As well as encryption settings, this also locks out inventory_mode and description.
Also missing, not directly related to this API but logically part of a host, is the ability to configure host macros.
It ignores nothing. It is only preprocessing of all parameters to form them properly (pop them out of the dictionary) for next run of the state module and for passing them properly to zabbix execution module. If this is an issue could you, please, send some output?
@slivik it's trivial to demonstrate that they're ignored. Here's one example: If the host doesn't exist it will be created, but the name not set. If it already exists, then the name will not be changed,
test zabbix_host:
zabbix_host.present:
- host: {{ grains['id'] }}
- visible_name: 'test'
Show me in the code where kwargs is passed to the execution module.
@slivik I'm confused why you're claiming it ignores nothing, when you're the one who raised this issue in the first place.
@OrangeDog You describe the situation before I introduced this fix. The line 71 of the fixed code does exactly what you are expecting, i.e. assigns the kwargs to connection_args which is then passed to every call of Zabbix execution module. So if there is any Zabbix host object parameter present then it is passed to the execution module.
@slivik Oh, when I said I looked at the code I wasn't talking about your PR.
@OrangeDog Sorry for confusion. I thought I was writing to the PR thread.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
This (high severity) issue still exists
Thank you for updating this issue. It is no longer marked as stale.