-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm not sure if this will work as I haven't tested it, but try setting
source and content to 'undef' (no quotes) instead of false.

Trevor

On 12/22/2009 08:00 AM, Daniel Pittman wrote:
> G'day.
> 
> I sometimes want to write a 'define' that wraps some higher level behaviour
> around a low level 'file' statement, akin to this:
> 
>   define example ($source = false, $content = false) {
>     file { "/path/to/whatever/${name}":
>       ensure => file, source => $source, content => $content,
>       notify => Service["some-service"],
>       etc, etc, etc
>     }
>   }
> 
> This is great, except it doesn't work.  It returns an error that source is
> nil, if I specify content, and that is that.
> 
> Instead, I get to write out the same file stanza twice, once with content and
> once with source, as well as a third stanza that fails when neither is set.
> 
> 
> Wouldn't it be wonderful if there was a standard way to express this idiom?
> 
>         Daniel
> 
> ...now someone is gonna tell me that I missed something obvious, but that is
> fine with me: saving the time I waste on these is worth enough for me. :)
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAksxdz8ACgkQyjMdFR1108DeswCeMoBu3E3/LeXuGzXqn9rUzVAF
u9AAoKwvA7MxlfhNAl9PD6pnFrQSB176
=q/Dw
-----END PGP SIGNATURE-----

--

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.


Reply via email to