Issue #20923 has been updated by Erik Dalén.

Raphaël Pinson wrote:
> However, even if `undef` is munged as `nil`, the hiera functions will still 
> need to munge it to `:undef` internally so as to return `:undef` to Puppet…

Yes, exactly. They could even return nil to puppet though, as puppet will treat 
a nil return from a rvalue function the same as :undef.
But that is specifically for the hiera functions, there are many other 
functions that could benefit from this change as well, for example the stdlib 
count() function could be made a lot simpler.

Also functions like fqdn_rotate() from stdlib could return a correct return 
value for arrays that contain some undef values. At the moment they are all 
turned into empty strings in the returned array :(

----------------------------------------
Bug #20923: Hiera cannot take `undef` as a default value
https://projects.puppetlabs.com/issues/20923#change-91734

* Author: Raphaël Pinson
* Status: In Topic Branch Pending Review
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* Affected Puppet version: 
* Keywords: 
* Branch: https://github.com/puppetlabs/puppet/pull/1670
----------------------------------------
As discussed with Jeff McCune yesterday, I believe #13210 is not a duplicate of 
#15329, as #13210 can be fixed without fixing #15329 per se.

Here's the idea:

* Implement a new `:honor_undef` option for functions, defaulting to `false`;
* Implement a new `:hiera_munge_undef` option in puppet.conf, defaulting to 
`true` for backwards compatibility;
* Use `:honor_undef = true` in all hiera functions when `:hiera_munge_undef` is 
set to `false`.

The code can be found in this PR: https://github.com/puppetlabs/puppet/pull/1670


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to