]> gitweb.fluxo.info Git - puppet-common.git/commitdiff
line: do a full string match of $line instead of a regex match
authorDavid Schmitt <david@schmitt.edv-bus.at>
Thu, 26 Jun 2008 10:01:24 +0000 (12:01 +0200)
committerDavid Schmitt <david@schmitt.edv-bus.at>
Thu, 26 Jun 2008 10:01:24 +0000 (12:01 +0200)
This allows $line to contain '/' characters and is generally the safer
thing to do.

Patch from Francois Deppierraz <francois.deppierraz@camptocamp.com>

manifests/defines/line.pp

index 2eb8f98e89e0f4c0eb07009980a5e5fdb1ecc4a1..c055f5b9c334bf09c5b5de450f9961ba696b40dc 100644 (file)
@@ -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}'"
                        }
                }