On 05/12/2011 05:59 PM, Luke Baker wrote:> Hey there,
> 
> I have the following class that defines an array:
> 
> class iptables::hyperion {
>   system_ips [
>     ''ip'',
>     ''ip'',
>     ''ip'',
>     ...
>   ]
> }
> 
> To use this variable in a template, I''m setting it to a
''local''
> variable in the node definition:
> 
> node ''mynode'' inherits basenode {
>   include iptables::hyperion
>   $system_ips = $iptables::hyperion::system_ips
> 
>   class { iptables:
>     fragments => [ ''hyperion.erb'']
>   }
> }
> 
> I can then access and use $system_ips in a template for that node (in
> this case, ''hyperion.erb''). Does this fit a common
pattern? I know
> that in a template you can use
''scope.lookupvar(''var'')''. Should I be
> using said function in the template to access
> $iptables::hyperion::system_ips, instead of reassigning it in the node
> definition?
> 
Hi,
I try and wrap almost all templates in defines and make all variables
used by the template parameteres of those defines.
I don''t need to care about scoping, I can sanely define default values
outside the template and I can document the set of required variables
( = mandatory parameters) easily.
Cheers,
Felix
-- 
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
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.