Try this:
notifies :run, resources(:execute => "cluster_rebal[MainCluster])", :immediately
Bruce Davis
From: Chaim Keren-Tzion <
">
>
Reply-To: " "> " < "> > Date: Sunday, August 25, 2013 11:47 AM To: chef < "> > Subject: [chef] Using a variable populated below in a resource defined above I have a case where I assign a variable "known_nodes" in a resource but need to use it on another resource which I've defined above that one, and set the action to ':nothing', and am calling it from below. This does not work since the code is executed in order from top to bottom. How could I do this properly? Here is the code: TAI cluster_name = node["cluster_name"]separator="," known_nodes=self.node['ipaddress'] cluster_rebal "MainCluster" do knownNodes known_nodes action :nothing end node['member_ips'].each do |node_name,node_ip| if node_ip != self.node['ipaddress'] known_nodes=known_nodes+separator+"#{node_ip}" add_node "#{cluster_name}" do hostname node_ip notifies :rebalance, "cluster_rebal[MainCluster]", :immediately end end end |
Archive powered by MHonArc 2.6.16.