Issue #4155 has been updated by Brice Figureau.

Tracker changed from Bug to Feature
Category set to parser
Status changed from Investigating to Needs design decision
Assigned to changed from Brice Figureau to Markus Roberts

I have mixed feelings about this feature request.

First, the syntax. $,{ and } that are usually used for variable interpolation 
in Puppet are reserved keywords in the regex space. That means we'll have to 
find a new syntax.

Second, how do we handle special regex characters (ie $,{,+,*..) in the 
interpolated result of the variable. Should we escape those?

Third, I'm not sure the use case would be that frequent. In the provided 
example this could be better replaced by an array and the new 'in' operator 
(which I think will be in 2.6). (Of course I can be wrong).

Markus, what do you think?
----------------------------------------
Feature #4155: Using variables in regex
http://projects.puppetlabs.com/issues/4155

Author: christian c
Status: Needs design decision
Priority: Normal
Assigned to: Markus Roberts
Category: parser
Target version: 
Affected version: 0.25.4
Keywords: regex variable regular expression
Branch: 


It seems as if it is not possible to match the content of a variable in a regex:

$users = "peter root user1 wwwrun"
$username = "user1"
file {  "userdata.tar.bz2":
                source => "puppet://$server/modules/$module/userdata.tar.bz2",
                ensure => $users ? {
                                /${username}/ => absent,
                                default => present,
                        },

} 
I did quite a lot variations in writing the variable (#{variable}, \$variable, 
\$\{variable\}) but nothing worked.
If it's already possible, it would be nice to mention it in the docs.

Also see: 
http://groups.google.com/group/puppet-users/browse_thread/thread/132d72437ac11095


-- 
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to