[chef-dev] attributes of other nodes are not available during the first chef-client run ?


Chronological Thread 
  • From: Hui Hu < >
  • To:
  • Subject: [chef-dev] attributes of other nodes are not available during the first chef-client run ?
  • Date: Mon, 12 Nov 2012 18:37:42 +0800

Hi,

I have a recipe like this:

puts node[:fqdn]  # => fqdn of the node itself
n[:fqdn]zk_servers = search(:node, "cluster_name:abc AND role:zookeeper")
quorum = zk_servers.collect { |n| n[:fqdn] }
puts quorum..to_s  # => ["", "", ""]   # but expected result is an array of fqdn of all zookeeper nodes
This code in recipe is executed in Compile phase.  Seems the node[:fqdn] or node[:ipaddress] or other nodes is not available yet, however node[:fqdn] of the node itself is available.

If this is true, how about saving the node to Chef Server immediately after ohai collects the automatic attributes ? So the node can get other nodes' fqdn and ip.

Thanks
Jesse Hu  @Beijing



Archive powered by MHonArc 2.6.16.

§