NoMethodError:未定义的方法`full_name'为nil:厨师Zabbix食谱的NilClass

时间:2015-03-26 18:34:48

标签: ruby chef chef-recipe

我在我自己的一本食谱中使用zabbix食谱(https://supermarket.chef.io/cookbooks/zabbix)通过源在节点上安装zabbix代理。我指定:include_recipe "zabbix::agent"然后在食谱的berkshelf中。

问题是,如果我在节点上手动执行chef-client,我认为没问题。厨师运行成功完成。它是在每30分钟启动的厨师运行中因此错误而失败。

[2015-03-26T18:02:01+00:00] INFO: Sending resource update report (run-id: aa2e95d5-32f5-4185-a049-5ea3808c0522)
[2015-03-26T18:02:02+00:00] ERROR: zabbix_source[install_zabbix_agent] (zabbix::agent_source line 36) had an error: NoMethodError: chef_gem[zabbixapi] (zabbix::_providers_common line 1) had an error: NoMethodError: undefined method `full_name' for nil:NilClass
[2015-03-26T18:02:02+00:00] ERROR: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
[2015-03-26T18:02:02+00:00] ERROR: Sleeping for 1800 seconds before trying again

在调查时,我发现配方zabbix/recipes/_providers_common.rb是安装宝石zabbixapi的配方。但是在仅使用zabbix :: agent配方时不会调用此配方,但我确实确认节点中存在gem zabbixapi

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/zabbixapi-0.6.6/lib/zabbixapi

我已经通过github为这本食谱提交了一个问题,但等待回复。

PS:厨师 - 客户11.4正在使用

1 个答案:

答案 0 :(得分:0)

使用以下条目

创建/etc/default/chef-client
#!/bin/bash
export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'

通过/etc/init.d/chef-client

获取
#added for the zabbix::agent recipe
[ -f /etc/default/chef-client ] && . /etc/default/chef-client