On Sun, Mar 22, 2015 at 9:05 AM Henrik Lindberg <
henrik.lindb...@cloudsmith.com> wrote:


> That is because an undef is passed as an empty string when given to
> functions (functions in general are still 3.x. API when using future
> parser, and also in 4.0).
>

This explains some of the errors I've had in the past but been unable to
understand. I recall now trying to find out what to expect to be returned
when writing functions & rspec examples and being stymied by the absense of
this critical detail from the documentation.

I see now too that I was not just being lazy; neither the "Functions"
section of the Language Guide nor the Custom Functions Guide -- searching
for "undef", "null", "empty" and "return" does not yield this datum:

http://docs.puppetlabs.com/puppet/3.7/reference/lang_functions.html
http://docs.puppetlabs.com/guides/custom_functions.html

It also reveals one of the limitations of testing functions w/rspec-puppet:
Since the result of the function call does not go through the Puppet
compiler itself but stays all within Ruby, results can be misleading. (The
alternative, testing the results of the function call within a "hosts"
example using either `:pre_condition` or `fixtures/manifests/site.pp` is
non-obvious and not terribly well-documented.)

I'll file bugs on the docs now.

Wil

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAMmm3r5_S-COV7HMQKyKTpt4wfmZB-XfHi6FXXQhJaq-QB4hwg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to