[chef] seeking variable template help


Chronological Thread 
  • From: Jennifer Fountain < >
  • To: " " < >
  • Subject: [chef] seeking variable template help
  • Date: Thu, 11 Jun 2015 19:00:55 -0400

Here is what I am trying to do:

<% %w[zone1 zone1].each do |role| -%>
zone "<%= role %>.domain.com" in {
    type master;
    file "<%= role %>.domain.conf";
    <% if [:bind][role][:notify] != nil %>
        notify yes;
        also-notify { [<%= [:bind][role][:notify_ip] %>; };
    <% end %>
    allow-update { <%= [:bind][role][:allow_update_ip] %>; };

};
<% end %>

This works as expected:
<% %w[zone1 zone1].each do |role| -%>
zone "<%= role %>.domain.com" in {
    type master;
    file "<%= role %>.domain.conf";
};
<% end %>

This not so much:
    <% if [:bind][role][:notify] != nil %>
        notify yes;
        also-notify { [<%= [:bind][role][:notify_ip] %>; };
    <% end %>
    allow-update { <%= [:bind][role][:allow_update_ip] %>; };

}; 

I have tried several different variations but chef_zero is still throwing errors. 

eg: Chef::Mixin::Template::TemplateError (no implicit conversion of String into Integer) on line #68:

Is this not possible? Thanks for any advice!

--


Jennifer Fountain
DevOPS



Archive powered by MHonArc 2.6.16.

§