On Thu, Dec 23, 2010 at 03:49:34PM -0800, Me wrote: > On Thu, Dec 23, 2010 at 3:34 PM, Stefan Schulte > <stefan.schu...@taunusstein.net> wrote: > > On Thu, Dec 23, 2010 at 10:30:22AM -0800, Me wrote: > >> > >> <% if dns_role == "master" then %> > >> # > >> # I'm a BIND <%= dns_role %> > >> # > >> cp -f $startdir/zones/* /var/named/internal/ > >> <% end %> > SNIP > > > > To your actual problem: What happens if you just put a <%= dns_role %> > > in front of your if-statement. Are you sure dns_role is actual set to the > > correct value (no hidden blanks or anything)? If dns_role is correctly > > set but your if-statement is still not evaluated try with dns_role.to_s > > to make sure its a string. Or maybe there is syntax error, missing > > bracket or whatever in your template (or node manifest that mixes up > > scope) > > > > -Stefan > > > That's why I put the example in where it has "# I'm a BIND <%= > dns_role %>" - it does indeed print out "master" without any blanks or > anything. > > It just plain doesn't work, when it seems it should. I ended up just > printing it out into the shell script and having the shell compare > what's substituted with the string "master" - and of course it works. > I've worked around the problem.
I don't really get it. You're testing dns_role agains "master". And you can see that dns_role is indeed "master" when you just use some simple <%= dns_role %>. And the code inside your if statement is evaluated. So what exactly is the problem? Or is your problem that even nodes that dont have dns_role set are including this cp command? And dns_role is still "master" when you never set it to "master"? Or do you see the comments but no cp command? I just put your snippet in a template and it works as expected. -Stefan
pgpK8AwP31IbB.pgp
Description: PGP signature