我不是在getting输出和错误
------异常-------
课程:厨房:: ActionFailed
消息:1个动作失败。"
食谱/测试/集成/节点 JSON文件
{
"id": "hive server",
"chef_type": "node",
"environment": "dev",
"json_class": "Chef::Node",
"run_list": [],
"automatic": {
"hostname": "test.net",
"fqdn": "127.0.0.1",
"name": "test.net",
"ipaddress": "127.0.0.1",
"node_zone": "green",
"roles": []
},
"attributes": {
"hiveserver": "true"
}
}
食谱
hiveNodes = search(:node, "hiveserver:true AND environment:node.environment AND node_color:node["node_color"])
# hiveserverList = ""
# hiveNodes.each |hnode| do
# hiveserverList += hnode
#end
#file '/tmp/test.txt' do
# content '#{hiveserverList}'
#end
我认为您的意思是将"hiveserver:true AND chef_environment:#{node.chef_environment} AND node_color:#{node["node_color"]}"
用作搜索字符串。#{}
语法是将Ruby表达式值嵌入到字符串中的方式。同样出于复杂的向后兼容的原因,节点上的环境称为 chef_environment
。