我不打算输出错误
------ -------异常
Class:Kitchen :: 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
答案 0 :(得分:0)
我认为您的意思是使用"hiveserver:true AND chef_environment:#{node.chef_environment} AND node_color:#{node["node_color"]}"
作为搜索字符串。 #{}
语法是将Ruby表达式值嵌入字符串的方法。此外,由于复杂的向后compat,节点上的环境称为chef_environment
。