Method: Chef::Node#to_hash

Defined in:
lib/chef/node.rb

#to_hashObject

Transform the node to a Hash



461
462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/chef/node.rb', line 461

def to_hash
  index_hash = Hash.new
  index_hash["chef_type"] = "node"
  index_hash["name"] = name
  index_hash["chef_environment"] = chef_environment
  attribute.each do |key, value|
    index_hash[key] = value
  end
  index_hash["recipe"] = run_list.recipe_names if run_list.recipe_names.length > 0
  index_hash["role"] = run_list.role_names if run_list.role_names.length > 0
  index_hash["run_list"] = run_list.run_list if run_list.run_list.length > 0
  index_hash
end