-2

I am not geeting output and error

------Exception-------

Class: Kitchen::ActionFailed

Message: 1 actions failed."

cookbook/test/integration/nodes Json file

{
  "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"
  }
}

Recipe

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
coderanger
  • 52,400
  • 4
  • 52
  • 75
Udhay
  • 7
  • 7

1 Answers1

0

I think you mean to be using "hiveserver:true AND chef_environment:#{node.chef_environment} AND node_color:#{node["node_color"]}" as your search string. The #{} syntax is how you embed a Ruby expression value in to a string. Also for reasons of complex backwards compat, the environment on a node is called chef_environment.

coderanger
  • 52,400
  • 4
  • 52
  • 75