Re: [Puppet Users] Template conditionals

2011-05-25 Thread Nan Liu
On Tue, May 24, 2011 at 9:06 AM, Aaron Grewell wrote: > Argh, I'll have to take that back.  The docs are right, the quotes are in > fact necessary.  Without them has_variable will always return false. My bad, responded in haste. Unquoted in ruby is actually a variable, so no that wouldn't work co

Re: [Puppet Users] Template conditionals

2011-05-24 Thread Aaron Grewell
Argh, I'll have to take that back. The docs are right, the quotes are in fact necessary. Without them has_variable will always return false. Here's the rub: If a variable is never declared then has_variable returns false. If it's set to 'undef' then it returns true. That wouldn't be so bad if y

Re: [Puppet Users] Template conditionals

2011-05-24 Thread Aaron Grewell
Yup, that works. FYI there's a bug in the docs. The example shown here: http://docs.puppetlabs.com/guides/templating.html#undefined-variables Looks like so: <% if has_variable?("myvar") then %> myvar has <%= myvar %> value <% end %> On Mon, May 23, 2011 at 4:59 PM, Nan Liu wrote: > On Mon, Ma

Re: [Puppet Users] Template conditionals

2011-05-23 Thread Nan Liu
On Mon, May 23, 2011 at 4:09 PM, Aaron Grewell wrote: > I've got a conditional statement that isn't working the way I expect.  I've > created a define() for building network interfaces, but two of the entries > (master & slave) are only appropriate for bonded interfaces.  I would like > them to be

[Puppet Users] Template conditionals

2011-05-23 Thread Aaron Grewell
I've got a conditional statement that isn't working the way I expect. I've created a define() for building network interfaces, but two of the entries (master & slave) are only appropriate for bonded interfaces. I would like them to be completely excluded from regular interfaces. This seems easy