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 [email protected].
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.