From: David Schmitt Date: Thu, 26 Jun 2008 10:01:24 +0000 (+0200) Subject: line: do a full string match of $line instead of a regex match X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=07ebdfa2c59684e79b0a1904858c9072b47601c5;p=puppet-common.git line: do a full string match of $line instead of a regex match This allows $line to contain '/' characters and is generally the safer thing to do. Patch from Francois Deppierraz --- diff --git a/manifests/defines/line.pp b/manifests/defines/line.pp index 2eb8f98..c055f5b 100644 --- a/manifests/defines/line.pp +++ b/manifests/defines/line.pp @@ -32,7 +32,7 @@ define line($file, $line, $ensure = 'present') { } } absent: { - exec { "perl -ni -e 'print unless /^\\Q${line}\\E\$/' '${file}'": + exec { "perl -ni -e 'print if \$_ ne \"${line}\n\";' '${file}'": onlyif => "grep -qFx '${line}' '${file}'" } }