On Jul 6, 2010, at 6:40 AM, Christian Casar wrote:
> Well, how do I use the content of a variable in regex?
>
> $username = "user1"
> file { "userdata.tar.bz2":
> source => "puppet://$server/modules/$module/
> userdata.tar.bz2",
> ensure => $users ? {
> /$username/ => absent,
> default => present,
> },
> }
>
> $users is a custom fact that contains all local users:
>
> users => at avahi bin daemon dnsmasq ftp games haldaemon lp mail
> messagebus nobody ntp polkituser postfix pulse root sshd suse uuidd
> wwwrun man news uucp puppet user1
>
> When I hardcode "user1" into the regex my test works fine and the file
> is removed.
>
> But things like /$variable/ or /\$variable/ or /#{variable}/ just
> don't work.
> Is it even possible in version 0.25.4?
Try changing #{variable} to ${variable}
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" 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-users?hl=en.