Adding delete_lines
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 26 Dec 2009 00:33:24 +0000 (22:33 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 26 Dec 2009 00:33:24 +0000 (22:33 -0200)
manifests/defines/delete_lines.pp [new file with mode: 0644]

diff --git a/manifests/defines/delete_lines.pp b/manifests/defines/delete_lines.pp
new file mode 100644 (file)
index 0000000..28d2362
--- /dev/null
@@ -0,0 +1,5 @@
+define delete_lines($file, $pattern) {
+   exec { "/bin/sed -i -r -e '/$pattern/d' $file":
+      onlyif => "/bin/grep -E '$pattern' '$file'",
+   }
+}