From ad81b0f97758cb4948a696833581d1bd3c933e3d Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 5 Oct 2007 16:04:31 -0400 Subject: Make the usage more friendly --- manifests/defines/replace.pp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'manifests') 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", } } - - - -- cgit v1.2.3