A quick check in shef (version 10.24) tells me that node["name"] returns nil, but node.name gives the expected result:Ohai2uchef > node['name']=> nilchef > node.name=> "mynode"--Adam MielkeSystem EngineerUniversity of MinnesotaOn Thu, Mar 14, 2013 at 1:14 PM, Jeremy Koerber < " target="_blank"> > wrote:
Hi,
I’m trying to modify the community memcached recipe such that it will source one template file if the node name starts with qa, and another if the node name is anything else. But no matter what I try, the recipe seems to ignore the conditional and just goes with the “else” block. So the result is that my nodes that are named qa* are getting my production template sourced. I even tried just setting the node name conditional to the exact name of a specific node, and still that node ends up with the default template, not the QA one specified in the conditional. Here’s the conditional:case node["name"] when "qa*" template "/opt/zookeeper/conf/zk.conf" do source "zk.qa.conf.erb" owner "root" group "root" mode "0644" end else template "/opt/zookeeper/conf/zk.conf" do source "zk.prod.conf.erb" owner "root" group "root" mode "0644" end end
I also have these nodes in a separate chef environment called “qa”, but I’m not having any luck keying off that either. Any ideas? Here’s the output of a ‘knife node show’ for the node in question:
knife node show -Fj qa-memcached01-1-i-91e11be3 { "name": "qa-memcached01-1-i-91e11be3", "chef_environment": "qa", "run_list": [ "role[memcached]" ], "normal": { "memcached": { "memory": "384" }, "tags": [ ] } }
Thanks, Jeremy
--
Archive powered by MHonArc 2.6.16.