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? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Tue, Jul 6, 2010 at 6:40 AM, Christian Casar <c.casar@web.de> wrote:> Well, how do I use the content of a variable in regex?...> But things like /$variable/ or /\$variable/ or /#{variable}/ just > don''t work. > Is it even possible in version 0.25.4?I couldn''t get this to work either. I get the same behavior against master, so this may not be fixed in 2.6. I recommend filing a bug for this. Thanks, -- Jeff McCune http://www.puppetlabs.com/ -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Tue, Jul 6, 2010 at 10:40 AM, Patrick Mohr <kc7zzv@gmail.com> wrote:>> >> Is it even possible in version 0.25.4? > > Try changing #{variable} to ${variable}I tried this, it doesn''t work. Here''s my test: # Regular Expression Test $who = "jeff" $party = "jeff, john, bill, carrie" $match = $party? { /"${jeff}"/ => "Jeff Match", default => "Default Match" } notice("Match is [${match}]") -- Jeff McCune http://www.puppetlabs.com/ -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Ok, I going to file a bugreport for this. On 6 Jul., 20:02, Jeff McCune <j...@puppetlabs.com> wrote:> On Tue, Jul 6, 2010 at 10:40 AM, Patrick Mohr <kc7...@gmail.com> wrote: > > >> Is it even possible in version 0.25.4? > > > Try changing #{variable} to ${variable} > > I tried this, it doesn''t work. > > Here''s my test: > > # Regular Expression Test > > $who = "jeff" > $party = "jeff, john, bill, carrie" > > $match = $party? { > /"${jeff}"/ => "Jeff Match", > default => "Default Match" > > } > > notice("Match is [${match}]") > > -- > Jeff McCunehttp://www.puppetlabs.com/-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.