def find_servers
      # need a run_context to find anything in
      return nil unless run_context
      # If there are already servers in attribs use those
      return node[:etcd][:servers] if node.key?(:etcd) &&
                                      node[:etcd].key?(:servers)

      # if we have already searched in this run use those
      return node.run_state[:etcd_servers] if node.run_state.key? :etcd_servers

      # find nodes and build array of ip's
      etcd_nodes = search(:node, search_query)
      servers = etcd_nodes.map { |n| n[:ipaddress] }

      # store that in the run_state
      node.run_state[:etcd_servers] = servers
    end
def find_servers
      # need a run_context to find anything in
      return nil unless run_context
      # If there are already servers in attribs use those
      return node[:etcd][:servers] if node.key?(:etcd) &&
                                      node[:etcd].key?(:servers)

      # if we have already searched in this run use those
      return node.run_state[:etcd_servers] if node.run_state.key? :etcd_servers

      # find nodes and build array of ip's
      etcd_nodes = search(:node, search_query)
      servers = etcd_nodes.map { |n| n[:ipaddress] }

      # store that in the run_state
      node.run_state[:etcd_servers] = servers
    end
def find_servers # need a run_context to find anything in return nil unless run_context # If there are already servers in attribs use those return node [ :etcd ] [ :servers ] if node . key? ( :etcd ) && node [ :etcd ] . key? ( :servers ) # if we have already searched in this run use those return node . run_state [ :etcd_servers ] if node . run_state . key? :etcd_servers # find nodes and build array of ip's etcd_nodes = search ( :node , search_query ) servers = etcd_nodes . map { | n | n [ :ipaddress ] } # store that in the run_state node . run_state [ :etcd_servers ] = servers end
Find other Etd Servers by looking at node attributes or via Chef Search
Find other Etd Servers by looking at node attributes or via Chef Search