lib/cluster_chef/discovery.rb
# Walk the list of chef nodes and
# * vivify the server,
# * associate the chef node
# * if the chef node knows about its instance id, memorize that for lookup
#   when we discover cloud instances.
Walk the list of chef nodes and
vivify the server,
associate the chef node
if the chef node knows about its instance id, memorize that for lookup
when we discover cloud instances.
Walk the list of chef nodes and vivify the server associate the chef node if the chef node knows about its instance id memorize that for lookup when we discover cloud instances .
def discover_chef_nodes!
      chef_nodes.each do |chef_node|
        if (cchef = chef_node['cluster_chef'])
          cluster_name = cchef["cluster"] || cchef["name"]
          facet_name =  cchef["facet"]
          facet_index = cchef["index"]
        elsif chef_node["cluster_name"] && chef_node["facet_name"] && chef_node["facet_index"]
          cluster_name = chef_node["cluster_name"]
          facet_name = chef_node["facet_name"]
          facet_index = chef_node["facet_index"]
        elsif chef_node.name
          ( cluster_name, facet_name, facet_index ) = chef_node.name.split(/-/)
        else
          next
        end
        svr = ClusterChef::Server.get(cluster_name, facet_name, facet_index)
        svr.chef_node = chef_node
        @aws_instance_hash[ chef_node.ec2.instance_id ] = svr if chef_node[:ec2] && chef_node.ec2.instance_id
      end
    end
def discover_chef_nodes! chef_nodes . each do | chef_node | if ( cchef = chef_node [ 'cluster_chef' ] ) cluster_name = cchef [ "cluster" ] || cchef [ "name" ] facet_name = cchef [ "facet" ] facet_index = cchef [ "index" ] elsif chef_node [ "cluster_name" ] && chef_node [ "facet_name" ] && chef_node [ "facet_index" ] cluster_name = chef_node [ "cluster_name" ] facet_name = chef_node [ "facet_name" ] facet_index = chef_node [ "facet_index" ] elsif chef_node . name ( cluster_name , facet_name , facet_index ) = chef_node . name . split ( / - / ) else next end svr = ClusterChef :: Server . get ( cluster_name , facet_name , facet_index ) svr . chef_node = chef_node @aws_instance_hash [ chef_node . ec2 . instance_id ] = svr if chef_node [ :ec2 ] && chef_node . ec2 . instance_id end end
Walk the list of chef nodes and
 vivify the server,
 associate the chef node
 if the chef node knows about its instance id, memorize that for lookup
when we discover cloud instances.
Walk the list of chef nodes and vivify the server associate the chef node if the chef node knows about its instance id memorize that for lookup when we discover cloud instances .