zabbix
zabbix copied to clipboard
Property `method` of resource `zabbix_api_call` overwrites an existing method
Hi chef-client -v Chef: 13.2.20
Chef Server version is 12.15.6.
Recipe Compile Error in /var/chef/cache/cookbooks/zabbix/resources/api_call.rb
================================================================================
ArgumentError
-------------
Property `method` of resource `zabbix_api_call` overwrites an existing method.
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/zabbix/resources/api_call.rb:5:in `class_from_file'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/zabbix/resources/api_call.rb:
1: actions :call
2: default_action :call
3:
4: attribute :server_connection, :kind_of => Hash, :required => true
5>> attribute :method, :kind_of => [String, Symbol], :required => true
6: attribute :parameters, :kind_of => Hash, :required => true
7:
System Info:
------------
chef_version=13.2.20
platform=centos
platform_version=7.3.1611
ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
program_name=chef-client worker: ppid=61391;start=16:56:34;
executable=/opt/chef/bin/chef-client
Checked with previous versions of chef client 13.x same error
Same here. Did you managed to resolve the issue?
I made the cookbook working with CentOS 7, it is certainly not a good fix, just that it is working. I am just using this cookbook deploy clients.
changed resource api_call.rb in providers to
action :call do
Chef::Zabbix.with_connection(new_resource.server_connection) do |connection|
connection.query(
:api_method => new_resource.method,
:params => new_resource.parameters
)
end
new_resource.updated_by_last_action(true)
end
def load_current_resource
run_context.include_recipe 'zabbix::_providers_common'
require 'zabbixapi'
end
def validate_parameters(parameters)
Chef::Log.error("#{parameter} isn't an Hash") unless parameters.is_a?(Hash)
end
Changed resources/api_call.rb to
actions :call
default_action :call
attribute :server_connection, :kind_of => Hash, :required => true
attribute :api_method, :kind_of => [String, Symbol], :required => true
attribute :parameters, :kind_of => Hash, :required => true
Also in templates and many places attributes are called like,
node.zabbix.attribute_value
This resulted in failure for me on chef client 13.x
changed this to
node['zabbix']['attribute_value']
Now the chef converge is working for me.