I think your original snippet doesn't work because the first if is inside an <%= %> block. So the rest of the code probably doesn't parse right.
On Thu, Oct 16, 2008 at 2:20 PM, Gary Richardson <[EMAIL PROTECTED]>wrote: > Thanks, that got it going for me. I don't know if there was a typo in my > block of code, but it didn't work for the first time around. > > > On Wed, Oct 15, 2008 at 6:05 PM, Andrew Shafer <[EMAIL PROTECTED]>wrote: > >> >> Gary, >> >> The templates are using standard ERB, which essentially gives you the >> ability to do arbitrary conditional logic using ruby. >> >> Anything between <% %> is logic code and <%= %> is evaluated and printed. >> >> <% if condition %> >> <%= print_this %> >> <% else %> >> default >> <% end %> >> >> Play with ERB, it is very flexible. >> >> >> >> >> On Wed, Oct 15, 2008 at 6:24 PM, Gary Richardson < >> [EMAIL PROTECTED]> wrote: >> >>> Hey, >>> >>> I'd like to do something like this in my template: >>> >>> <%= if has_variable?('some_variable') then %><%= some_variable%><% else >>> %>default<% end %> >>> >>> http://reductivelabs.com/trac/puppet/wiki/PuppetTemplating talks about >>> conditionals, but not so much about if/else. >>> >>> Any suggestions? >>> >>> Thanks! >>> >>> >>> >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---