Chef infra 如何在chef中设置节点配置?

Chef infra 如何在chef中设置节点配置?,chef-infra,Chef Infra,我有一本安装elasticsearch的包装食谱 cookbook使用以下语法支持动态配置文件: node.elasticsearch[:custom_config] 当我尝试在我的包装器cookbook中实现此功能时,会出现以下错误: 12>> node[:elasticsearch][:custom_config] = {'indices.breaker.fielddata.limit' => '75%'} 13: node[:elasticse

我有一本安装elasticsearch的包装食谱

cookbook使用以下语法支持动态配置文件:

node.elasticsearch[:custom_config]

当我尝试在我的包装器cookbook中实现此功能时,会出现以下错误:

   12>> node[:elasticsearch][:custom_config] = {'indices.breaker.fielddata.limit' => '75%'}
        13:  node[:elasticsearch][:custom_config] = {'indices.fielddata.cache.size' => '65%'}
        14:  
        15:  
        16:  
        17:  # Work around for issue when no ssl certs are present
        18:  # https://github.com/elastic/cookbook-elasticsearch/commit/7bdaffc0a1b8e2ae17dc9ab961a468daf9825b98
        19:  # normal[:elasticsearch][:nginx][:ssl][:cert_file] = nil
        20:  # normal[:elasticsearch][:nginx][:ssl][:key_file] = nil
        21:  


       Running handlers:

       Running handlers complete

       [2015-05-01T17:10:42+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       Chef Client failed. 0 resources updated in 0.969790492 seconds
       [2015-05-01T17:10:42+00:00] ERROR: Node attributes are read-only when you do not specify which precedence level to set. To set an attribute use code like `node.default["key"] = "value"'
       [2015-05-01T17:10:42+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
根据我的研究,似乎在chef 11和更新版本上,您必须这样指定您的范围:

node.set[:elasticsearch][:custom_config] { 'foo' => 'bar' }
node.default[:elasticsearch][:custom_config] { 'foo' => 'bar' }
不幸的是,在my default.rb中使用这些语法不起作用,因为foo和bar从未出现在我的配置中

覆盖包装器cookbook中的节点值的正确方法是什么

更新

我还尝试了以下语法,但没有成功

default['elasticsearch']['custom_config'] = {
  'indices.breaker.fielddata.limit' => '75%',
  'indices.fielddata.cache.size' => '65%'
}
实现此功能的代码位于此处:

**更新2**

看起来我的elasticsearch.yaml与github上的不同

我注意到我的有一排,而github没有。github也有定制,而我的没有。这两个版本都是烹饪手册的0.3.13版


它看起来像在工作,但是有两个elasticsearch文件

/usr/local/elasticsearch/conf/elasticsearch.yml
/usr/local/etc/elasticsearch/elasticsearch.yml
第一个未使用,但第二个已更新