Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
PUP 4.10.6
-
Platform Core
-
Needs Assessment
-
Not Needed
-
Needs Assessment
Description
So the documentation for return() says plainly that it will return from a lambda, ending evaluation of the function.
https://docs.puppet.com/puppet/4.10/function.html#return:
If called from within a lambda the return will return from the function evaluating the lambda.
So let's build a short manifest and use a function that evaluates a lambda:
with(1) |$num| {
|
return()
|
}
|
This creates an error:
$ puppet apply return_bug.pp
|
Error: return() from context where this is illegal at /tmp/return_bug.pp:2 on node
|
Reading the spec test confirms that this is expected behavior?
https://github.com/puppetlabs/puppet/blob/ebd96213cab43bb2a8071b7ac0206c3ed0be8e58/spec/unit/functions/return_spec.rb#L85-L94
I thought of perhaps creating this as a documentation bug, but this is failing on documented (and desirable) functionality.