Peter Berghold
2012-Mar-02 18:37 UTC
[Puppet Users] puppet (ruby?) equivalent of defiend()
In Perl we have the functionality of if ( defined($somevar) ) { ... do something .... } Is there an equivalent you can use within a puppet manifest? -- Peter L. Berghold Owner, Shark River Technical Solutions LLC -- 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.
Jeff McCune
2012-Mar-02 19:44 UTC
Re: [Puppet Users] puppet (ruby?) equivalent of defiend()
On Fri, Mar 2, 2012 at 10:37 AM, Peter Berghold <salty.cowdawg@gmail.com>wrote:> > In Perl we have the functionality of > > if ( defined($somevar) ) { > ... do something .... > } >if ( $somevar != undef) { ... } You can test this quickly using the --execute flag to puppet apply: % puppet apply -e ''if $foo == undef { notice "foo is undefined" } else { notice "foo is defined" }'' notice: Scope(Class[main]): foo is undefined notice: Finished catalog run in 0.01 seconds % FACTER_foo=bar puppet apply -e ''if $foo == undef { notice "foo is undefined" } else { notice "foo is defined" }'' notice: Scope(Class[main]): foo is defined notice: Finished catalog run in 0.01 seconds -Jeff -- 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.