aboutsummaryrefslogtreecommitdiff
path: root/manifests/defines/replace.pp
diff options
context:
space:
mode:
authorDavid Schmitt <david@dasz.at>2009-06-09 17:51:10 +0200
committerDavid Schmitt <david@dasz.at>2009-06-09 17:51:10 +0200
commitde7690c4e76ddd7c1f01d81fe92c75771da47c51 (patch)
tree1cba3866aa6db7beb2ba59bddefb508b5d0ddbb7 /manifests/defines/replace.pp
parentc65920d6b8d017c951838c72f4bbcb75d5b27234 (diff)
downloadpuppet-common-de7690c4e76ddd7c1f01d81fe92c75771da47c51.tar.gz
puppet-common-de7690c4e76ddd7c1f01d81fe92c75771da47c51.tar.bz2
RDoc-ify documentation
See http://club.black.co.at/david/puppet/doc/ for a current version of the RDoc output.
Diffstat (limited to 'manifests/defines/replace.pp')
-rw-r--r--manifests/defines/replace.pp15
1 files changed, 9 insertions, 6 deletions
diff --git a/manifests/defines/replace.pp b/manifests/defines/replace.pp
index a7a59b8..c9a98bd 100644
--- a/manifests/defines/replace.pp
+++ b/manifests/defines/replace.pp
@@ -8,6 +8,9 @@
# creating a template is often better than this hack.
#
# This define uses perl regular expressions.
+#
+# Use this only for very trivial stuff. Usually replacing the whole file is a
+# more stable solution with less maintenance headaches afterwards.
#
# Usage:
#
@@ -20,12 +23,12 @@
# To replace the current port in /etc/munin/munin-node.conf
# with a new port, but only disturbing the file when needed:
#
-# replace { set_munin_node_port:
-# file => "/etc/munin/munin-node.conf",
-# pattern => "^port (?!$port)[0-9]*",
-# replacement => "port $port"
-# }
-
+# replace {
+# set_munin_node_port:
+# file => "/etc/munin/munin-node.conf",
+# pattern => "^port (?!$port)[0-9]*",
+# replacement => "port $port"
+# }
define replace($file, $pattern, $replacement) {
$pattern_no_slashes = regsubst($pattern, '/', '\\/', 'G', 'U')
$replacement_no_slashes = regsubst($replacement, '/', '\\/', 'G', 'U')