From: Micah Anderson Date: Fri, 5 Oct 2007 20:04:31 +0000 (-0400) Subject: Make the usage more friendly X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=ad81b0f97758cb4948a696833581d1bd3c933e3d;p=puppet-common.git Make the usage more friendly --- diff --git a/manifests/defines/replace.pp b/manifests/defines/replace.pp index ae4498e..fcff84d 100644 --- a/manifests/defines/replace.pp +++ b/manifests/defines/replace.pp @@ -4,13 +4,20 @@ # Usage: # -# # replace the current port in /etc/munin/munin-node.conf -# # with a new, only disturbing the file when needed +# replace { description: +# file => "filename", +# pattern => "regexp", +# replacement => "replacement" +# +# For example, 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" # } + define replace($file, $pattern, $replacement) { $pattern_no_slashes = slash_escape($pattern) $replacement_no_slashes = slash_escape($replacement) @@ -20,6 +27,3 @@ define replace($file, $pattern, $replacement) { alias => "exec_$name", } } - - -