Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Cannot Reproduce
-
PUP 4.10.2
-
None
-
None
-
$ puppet --version
4.10.2
-
Froyo
-
Needs Assessment
-
Needs Assessment
Description
When we pass a Regexp to a class, the class understands it as a String. To wit:
{{class what ( |
Regexp[/^.$/] $param, |
) {
|
notice('yes') |
}
|
|
class { 'what': |
param => /^.$/,
|
}
|
$ puppet apply /tmp/z.pp
|
Error: Evaluation Error: Error while evaluating a Resource Statement, Class[Classname]: parameter 'param' expects a Regexp value, got String at /tmp/z.pp:7:1 on node cwl.hostopia.com}}
|
|
|
{{$regexp = /^.$/
|
notice(type($regexp))
|
|
class foo($bar) {
|
notice(type($bar))
|
}
|
|
class { 'foo': bar => $regexp }
|
|
Notice: Scope(Class[main]): Regexp[/^.$/]
|
Notice: Scope(Class[Foo]): String}}
|
https://gist.github.com/richardc/1380cda39d7bebca19ddc9dc06fb1a16
Functions seem better though.
# From <Volcane>
|
function x(Regexp $thing) { notice(type($thing)) } |
happily works.