]> gitweb.fluxo.info Git - puppet-loginrecords.git/commitdiff
replace old resources with stdlib functions
authormh <mh@immerda.ch>
Wed, 2 Jan 2013 10:45:03 +0000 (11:45 +0100)
committermh <mh@immerda.ch>
Wed, 2 Jan 2013 11:13:11 +0000 (12:13 +0100)
stdlib has the new file_line, which can also do the same as we
used replace for in one run.

README
manifests/faillog/disable.pp
manifests/faillog/enable.pp

diff --git a/README b/README
index 68cf39b1b67296270eaff1b5a63e09df9cddae97..06f29ea0b09e05cfa3a9c25feffdbaf271dbd550 100644 (file)
--- a/README
+++ b/README
@@ -11,7 +11,7 @@ Defaults to disable all supported login records.
 Dependencies
 ============
 
-- the common module: git://labs.riseup.net/shared-common
+- the stdlib module from puppetlabs: http://forge.puppetlabs.com/puppetlabs/stdlib
 
 Configuration
 =============
index 4e1df4edefbc6f1ddff9a9ba4376db206769204d..c55e39ed7c5097e8c6a0a381e2a46fb001f8dba4 100644 (file)
@@ -1,10 +1,6 @@
 # do not log any faillog
 class loginrecords::faillog::disable inherits loginrecords::faillog::enable{
-  Replace['loginrecords-faillog']{
-    pattern     => '^FAILLOG_ENAB[[:space:]]+yes$',
-    replacement => "FAILLOG_ENAB\tno",
-  }
-  Line['loginrecords-faillog']{
+  File_line['loginrecords-faillog']{
     line  => "FAILLOG_ENAB\tno",
   }
 }
index d600f6f4796e03127022e68e5c9d28907208ebe5..6120193d1dcd4fbc8dd939f72f087395051a39eb 100644 (file)
@@ -2,14 +2,9 @@
 class loginrecords::faillog::enable(
   $login_defs_file = '/etc/login.defs'
 ) {
-  replace{'loginrecords-faillog':
-    file        => $loginrecords::faillog::enable::login_defs_file,
-    pattern     => '^FAILLOG_ENAB[[:space]]+no$',
-    replacement => "FAILLOG_ENAB\tyes",
-  }
-  line{'loginrecords-faillog':
-    file    => $loginrecords::faillog::enable::login_defs_file,
-    line    => "FAILLOG_ENAB\tyes",
-    require => Replace['loginrecords-faillog'],
+  file_line{'loginrecords-faillog':
+    path  => $loginrecords::faillog::enable::login_defs_file,
+    match => '^FAILLOG_ENAB',
+    line  => "FAILLOG_ENAB\tyes",
   }
 }