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:
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:
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:
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
On Thu, Mar 14, 2013 at 11:31 AM, Adam Mielke adam@umn.edu wrote:
A quick check in shef (version 10.24) tells me that node["name"] returns
nil, but node.name gives the expected result:
Ohai2u adam@mynode
chef > node['name']
=> nil
chef > node.name
=> "mynode"
--
Adam Mielke
System Engineer
University of Minnesota
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:
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
On Thu, Mar 14, 2013 at 11:31 AM, Adam Mielke adam@umn.edu wrote:
A quick check in shef (version 10.24) tells me that node["name"] returns
nil, but node.name gives the expected result:
Ohai2u adam@mynode
chef > node['name']
=> nil
chef > node.name
=> "mynode"
--
Adam Mielke
System Engineer
University of Minnesota
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: