Lori Cho
2014-12-05 23:16:02 UTC
I have two variables and I want to compare them to each other. However,
the regex doesn't return true, because it seems to treat the variable in
the // as a literal.
Something like this:
$variable1 = 'foo'
$variable2 = 'foobar'
if($variable2 =~ /$variable1/) {
notify {"it works":}
} else {
notify {"regex did not work":}
}
***@test-slincsplunk1101r(~)# puppet apply /srv/tmp/test.pp
notice: regex did not work
notice: /Stage[main]//Notify[regex did not work]/message: defined 'message'
as 'regex did not work'
How can I do this?
the regex doesn't return true, because it seems to treat the variable in
the // as a literal.
Something like this:
$variable1 = 'foo'
$variable2 = 'foobar'
if($variable2 =~ /$variable1/) {
notify {"it works":}
} else {
notify {"regex did not work":}
}
***@test-slincsplunk1101r(~)# puppet apply /srv/tmp/test.pp
notice: regex did not work
notice: /Stage[main]//Notify[regex did not work]/message: defined 'message'
as 'regex did not work'
How can I do this?
--
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/d5fe93ec-b5ab-4e05-89ca-f88d0c6e00d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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/d5fe93ec-b5ab-4e05-89ca-f88d0c6e00d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.