【问题标题】:NoMethodError: undefined method `full_name' for nil:NilClass for the Chef Zabbix cookbookNoMethodError: undefined method `full_name' for nil:NilClass for the Chef Zabbix cookbook
【发布时间】:2015-05-30 22:20:05
【问题描述】:

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

问题是,如果我在节点上手动执行 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 是安装gem zabbixapi 的配方。但是仅使用 zabbix::agent 配方时不会调用此配方,但我确实确认 gem zabbixapi 存在于节点中

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

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

PS:chef-client 11.4 正在使用中

【问题讨论】:

  • 看起来像一个本地化问题,根据操作码.. 我将把解决方案发回一次,一切就绪(以防万一,有人遇到相同/类似的问题)

标签: ruby chef-infra chef-recipe


【解决方案1】:

使用以下条目创建 /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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-03-19
    • 2016-08-13
    • 1970-01-01
    • 2016-01-02
    • 2012-08-08
    • 2014-09-05
    • 1970-01-01
    相关资源
    最近更新 更多