Don''t use nil, use '''' (two quotes).
Then, in your template:
if ! empty?(variable) then ...stuff... end
I found nil to be fraught with getting interpreted as a string
sometimes...and not others.
Trevor
On Mon, May 24, 2010 at 4:27 PM, Baker, Luke Jefferson
<BakerLu@missouri.edu> wrote:> Hey there,
>
>
>
> I’ve started working with / deploying a definition for managing iptables
via
> templates. Is there a ‘better’ way to deal with default values? Here is a
> piece of what I’m working on..
>
>
>
> define iptablesBase(fragment = nil, dba_frag = nil) {
>
>
>
> case $fragment {
>
> nil: {
>
> $content = ''''
>
> }
>
> default: {
>
> $content = template($fragment)
>
> }
>
> }
>
>
>
> case $dba_frag {
>
> nil: {
>
> $dba_access = ''''
>
> }
>
> default: {
>
> $dba_access = template($dba_frag)
>
> }
>
> }
>
> …
>
>
>
> Is there a ‘better’ way to deal with default values? For instance, if I
> don’t want to define ‘dba_frag’, if I didn’t have a case or if statement to
> evaluate $dba_frag, then I would receive an error due to template
evaluating
> ‘nil’. Not sure if that makes sense, but I figured I would throw it out
> there.
>
>
>
> --Luke Baker
>
>
>
> --
> 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.
>
--
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
tvaughan@onyxpoint.com
-- This account not approved for unencrypted proprietary information --
--
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.