the value undef is passed as a empty string to the actual functions, not a ruby nil. So there's no way for a function to distinguish it from an actual empty string.
Unless you pass it in an array of course, like warning([undef]), then it will instead receive an array with the symbol :undef :) On 10 January 2014 09:52, David Schmitt <[email protected]> wrote: > Hi, > > Please note the results of the following tests. > > root@testagent:/srv/dasz# echo 'warning(defined(undef))' | puppet apply >> Warning: Scope(Class[main]): true >> Notice: Compiled catalog for testagent.example.org in environment >> production in 0.06 seconds >> Notice: Finished catalog run in 0.14 seconds >> root@testagent:/srv/dasz# echo 'warning(defined($foo))' | puppet apply >> Warning: Scope(Class[main]): true >> Notice: Compiled catalog for testagent.example.org in environment >> production in 0.03 seconds >> Notice: Finished catalog run in 0.14 seconds >> root@testagent:/srv/dasz# echo 'warning(defined(undefined))' | puppet >> apply >> Warning: Scope(Class[main]): false >> Notice: Compiled catalog for testagent.example.org in environment >> production in 0.03 seconds >> Notice: Finished catalog run in 0.14 seconds >> root@testagent:/srv/dasz# echo 'warning(undef)' | puppet apply >> Warning: Scope(Class[main]): >> Notice: Compiled catalog for testagent.example.org in environment >> production in 0.02 seconds >> Notice: Finished catalog run in 0.14 seconds >> root@testagent:/srv/dasz# echo 'warning($foo)' | puppet apply >> Warning: Scope(Class[main]): >> Notice: Compiled catalog for testagent.example.org in environment >> production in 0.02 seconds >> Notice: Finished catalog run in 0.14 seconds >> root@testagent:/srv/dasz# >> root@testagent:/srv/dasz# echo 'warning(undefined)' | puppet apply >> Warning: Scope(Class[main]): undefined >> Notice: Compiled catalog for testagent.example.org in environment >> production in 0.02 seconds >> Notice: Finished catalog run in 0.13 seconds >> root@testagent:/srv/dasz# echo 'warning(defined(File["/blah"]))' | >> puppet apply >> Warning: Scope(Class[main]): false >> Notice: Compiled catalog for testagent.example.org in environment >> production in 0.08 seconds >> Notice: Finished catalog run in 0.14 seconds >> root@testagent:/srv/dasz# echo 'warning(File["/blah"])' | puppet apply >> Warning: Scope(Class[main]): File[/blah] >> Notice: Compiled catalog for testagent.example.org in environment >> production in 0.08 seconds >> Notice: Finished catalog run in 0.14 seconds >> root@testagent:/srv/dasz# puppet --version >> 3.4.2 >> root@testagent:/srv/dasz# >> > > > It's sad, isn't it? At least I learned something today. > > > Regards, David > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/puppet-dev/52CFB4E1.4070408%40dasz.at. > For more options, visit https://groups.google.com/groups/opt_out. > -- Erik Dalén -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/CAAAzDLdHCQGc9O2-1XNmvavwaWZCjWz3_JDiCS_yBkkTL_OYmg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
