On Thu, Dec 23, 2010 at 4:10 PM, Daniel Pittman <dan...@rimspace.net> wrote: > On Fri, Dec 24, 2010 at 10:49, Me <info...@gmail.com> wrote: > >> There's no scoping issue - just seems that Puppet is buggy. Thanks for >> your help, I don't think there's a fix. > > I have a bunch of manifests and templates that do similar things, and > we never had any problems with them *except* for things like 'fork' > that are in the Ruby 'kernel' module. (Which is a Ruby / ERB issue, > more or less.) > > Can you post a minimal set of files to verify this? If it is a puppet > bug we would definitely want to fix it, and having the minimal > manifest and template that demonstrate it mean we can make sure it > *stays* fixed.
Ok, going back in SVN history... The nodes file: node /dns[0-9]+/ inherits globals { $dns_role = $hostname ? { # needs to be either "master" or "slave" /dns01/ => [ "master" ], # the 01 box is always the master by convention default => [ "slave" ], } include "defaults" include "host2dns" } The hosts2dns class has this in part of a file section: "${basedir}/scripts/host2dns.sh": owner => "0", group => "0", mode => "0550", ensure => present, content => template("OBFUSCATED/host2dns/host2dns.sh.erb"); ...and the template: # # This line generated by Puppet based on config variables. # Only copy zone files into place if we're a master. # <% if has_variable?("dns_role") && dns_role == "master" then %> cp -f $startdir/zones/* /var/named/internal/ <% end %> rndc reconfig -noexpired rndc reload ...everything else in it is straight shell. So with this template - the line with "cp" in it is *never* included in the generated file on both the master and slave boxes. It just never works. So by comparison, the same "host2dns" class has this in the files section: "/etc/named.conf": owner => "0", group => "0", mode => "0444", ensure => present, content => template("OBFUSCATED/host2dns/named.conf.erb"); ...and these template contents in named.conf.erb: // this line generated by Puppet based on config variables <% if has_variable?("dns_role") && dns_role != '' then -%> include "/etc/apple_zones_<%= dns_role %>.conf"; <% end -%> ...result in this: // this line generated by Puppet based on config variables include "/etc/apple_zones_master.conf"; That's the last line in named.conf, just telling the box to include the correct zones depending on master vs slave status. So it seems that Puppet is totally happy to detect if dns_role is empty, but not happy to tell me if it contains the value "master". What is wrong here? Thanks for following along, if you're still with me. ;) -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.