aboutsummaryrefslogtreecommitdiff
path: root/manifests/defines/replace.pp
diff options
context:
space:
mode:
authorroot <root@puppetmaster.black.co.at>2007-11-13 10:44:07 +0100
committerroot <root@puppetmaster.black.co.at>2007-11-13 10:44:07 +0100
commit9d7a47506c6d824d254774f2c7828e8cb65e236f (patch)
tree3e8d1711b596671de8065592b50138ba4f22c6de /manifests/defines/replace.pp
parent76483492e6e307e0591a45e87f8370e58d340529 (diff)
downloadpuppet-common-9d7a47506c6d824d254774f2c7828e8cb65e236f.tar.gz
puppet-common-9d7a47506c6d824d254774f2c7828e8cb65e236f.tar.bz2
common: minor improvements to config_file, replace and line
Diffstat (limited to 'manifests/defines/replace.pp')
-rw-r--r--manifests/defines/replace.pp4
1 files changed, 2 insertions, 2 deletions
diff --git a/manifests/defines/replace.pp b/manifests/defines/replace.pp
index d1c7496..c13325e 100644
--- a/manifests/defines/replace.pp
+++ b/manifests/defines/replace.pp
@@ -23,8 +23,8 @@ define replace($file, $pattern, $replacement) {
$pattern_no_slashes = slash_escape($pattern)
$replacement_no_slashes = slash_escape($replacement)
exec { "replace_${pattern}_${file}":
- command => "/usr/bin/perl -pi -e 's/$pattern_no_slashes/$replacement_no_slashes/' '$file'",
- onlyif => "/usr/bin/perl -ne 'BEGIN { \$ret = 1; } \$ret = 0 if /$pattern_no_slashes/; END { exit \$ret; }' '$file'",
+ command => "/usr/bin/perl -pi -e 's/${pattern_no_slashes}/${replacement_no_slashes}/' '${file}'",
+ onlyif => "/usr/bin/perl -ne 'BEGIN { \$ret = 1; } \$ret = 0 if /${pattern_no_slashes}/ && ! /\\Q${replacement_no_slashes}\\E/; END { exit \$ret; }' '${file}'",
alias => "exec_$name",
}
}