Actually I am trying to go around it :) I choose to use the classes array because of the an ordering issue I encountered while trying to build an array of iptables rules : the template would get evaluated before some the classes would get the chance to add lines to the array. I'm hoping that by using the classes array (which is in its finale state before the classes start to run) I can avoid the ordering issue. my question was about the ruby syntax of checking for undefined out of scope variables (or are you trying to tell me that theres no way around it ?).
Oded On Feb 11, 10:33 pm, Ohad Levy <ohadl...@gmail.com> wrote: > you might be hitting -http://projects.reductivelabs.com/issues/2309 > > OhadOn Thu, Feb 11, 2010 at 1:09 AM, Oded <oded.beno...@gmail.com> wrote: > > I'm trying to use (possibly) undefined variables that are not in the > > scope of my class in an erb template. > > How do I combine this : > > > <% if has_variable?("myvar") then %> > > myvar has <%= myvar %> value > > <% end %> > > > with this : > > <%= scope.lookupvar(myclass::myvar) %> > > > The idea is to get the iptables template to go through all the classes > > assigned to a machine and add lines on relevant classes only(by > > searching for a specific variable in that class),this way I will not > > be forced to edit the iptables template/class every time another > > module needs to change its iptable settings. > > > Without checking for undefined variables my code looks like this : > > > <% classes.each do |current_class| -%> > > <% scope.lookupvar(current_class::iptables_input_tags) %> > > <% end -%> > > > Oded > > > -- > > 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<puppet-users%2bunsubscr...@google > > groups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/puppet-users?hl=en. -- 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.