passing a regex as a class parameter

53 views
Skip to first unread message

Christopher Wood

unread,
Jun 27, 2017, 11:44:41 AM6/27/17
to puppet...@googlegroups.com
A little oddity I stumbled across while getting things wrong about somebody's pastebin entry in #puppet on freenode.

This thing:

class classname (
Regexp $param,
) {
notice('yes')
}

class { 'classname':
param => /^.$/,
}

Does this with puppet 4.10.2:

$ 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.me.com

Am I even supposed to be able to pass a Regexp to a class?

Christopher Wood

unread,
Jun 27, 2017, 1:02:26 PM6/27/17
to puppet...@googlegroups.com
After more discussion in #puppet on freenode, this thing:

https://tickets.puppetlabs.com/browse/PUP-7735
> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/20170627154426.b4agpelmzzwzre2h%40iniquitous.heresiarch.ca.
> For more options, visit https://groups.google.com/d/optout.

Henrik Lindberg

unread,
Jun 28, 2017, 4:45:49 AM6/28/17
to puppet...@googlegroups.com
Short answer: Not without turning on experimental feature using the
setting --rich_data. I noticed you filed a ticket for this and I
provided more information there
(https://tickets.puppetlabs.com/browse/PUP-7735)

- henrik
--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

Reply all
Reply to author
Forward
0 new messages