Open odyssey4me opened 10 years ago
It would appear that the offending line is this one: https://github.com/laradji/zabbix/blob/master/providers/host.rb#L161
I changed host["interfaces"].values.map
to host["interfaces"].map
and it appears to resolve the problem without any unwanted side-effects.
+1
+1 That works for me too. This issue occurs any time I try set node['zabbix']['agent']['templates']
and @odyssey4me's solution seems to work for me.
tks @odyssey4me @guilhem your the expert on this part of the cookbook :), what do you think ?
It also fixed the problem for me, I'm already using it. Please apply the proposed fix.
I don't know if it is just mine setup, but changing host["interfaces"].values.map
to host["interfaces"].map
just lead me to a new error.
Server answer API error: { "code": -32602, "message": "Invalid params.", "data": "Host cannot have more than one default interface of the same type." }
So, it tries to create the existing interface. After a little digging it appeared that it existing_interface
has keys as Strings, while desired_interface
has keys as Symbols.
That's why when there is a check if the interface already exists on https://github.com/laradji/zabbix/blob/master/providers/host.rb#L224, check fails.
I have fixed it by adding desired_interface = Hash[desired_interface.map{ |k, v| [k.to_s, v] }]
and existing_interface = Hash[existing_interface.map{ |k, v| [k.to_s, v] }]
after line 222 and line 223 respectively.
When changing the attributes for a host to update the host group or templates, the update library does not update the host's configuration.
The error:
If I delete the host from zabbix, then re-run chef-client it works as expected.