Issue #22574 has been reported by Henrik Lindberg.
----------------------------------------
Feature #22574: the loookup() function should support default value (and
possibly other options)
https://projects.puppetlabs.com/issues/22574
* Author: Henrik Lindberg
* Status: Unreviewed
* Priority: Normal
* Assignee:
* Category: databinding
* Target version:
* Affected Puppet version:
* Keywords: databinding lookup default
* Branch:
----------------------------------------
The lookup function currently has the signature(s)
<pre>
lookup(key)
lookup(key, type)
lookup(...) lambda
</pre>
For people not using future parser there is no good way to handle default
values. And when future parser is used it is a bit klunky having
to write the following:
<pre>
$a = lookup(key) {|$x| $x ? { undef => 'when missing', default => $x }}
</pre>
It has been suggested that options can be passed to the function (i.e. a hash),
and/or default given as the third parameter.
Propose the signature is changed as follows:
<pre>
lookup(key)
lookup(key, type)
lookup(...) lambda
lookup(key, type, default_value)
lookup(option_hash)
lookup(key, option_hash)
</pre>
The option hash could accept:
* `default` - the expression to use if nothing is found
* `type` - the type to assert
* `first_found` - a single key, or an array of keys to lookup in turn
</pre>
--
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.
For more options, visit https://groups.google.com/groups/opt_out.