No output from search in test kitchen
Throwing error check the recipe and suggest me some details
Node JSON file
{
"id": "cldb",
"chef_type": "node",
"json_class": "Chef::Node",
"run_list": [],
"automatic": {
"hostname": "cldb.net",
"fqdn":"127.0.0.1",
"name": "cldb.net",
"ipaddress": "127.0.0.1",
"roles": [],
"cldb" : true
}
}
Recipe
cldbNodes = search(:node, "cldb:true")
cldb = "#{cldbNodes["fqdn"]}"
file '/tmp/test.txt' do
content "#{cldb}"
end
To summarize from the comments above,
search(...)
returns an array so you need to get a specific element, usually the first, before you can access node data.Using the example above, it would be something like: