|
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 }}
https://pastebin.com/bHJ1vqub
{{ $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.
{{ <Volcane> function x(Regexp $thing) { notice(type($thing)) }
happily works }}
|