From 43cba80d2ede774ecf91cb26531ecbca0f097551 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 2 Jan 2013 11:43:18 +0100 Subject: linting according to puppet-lint --- manifests/faillog/disable.pp | 7 ++++--- manifests/faillog/enable.pp | 11 ++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'manifests/faillog') diff --git a/manifests/faillog/disable.pp b/manifests/faillog/disable.pp index c05e6bc..4e1df4e 100644 --- a/manifests/faillog/disable.pp +++ b/manifests/faillog/disable.pp @@ -1,9 +1,10 @@ +# do not log any faillog class loginrecords::faillog::disable inherits loginrecords::faillog::enable{ Replace['loginrecords-faillog']{ - pattern => '^FAILLOG_ENAB[[:space:]]+yes$', - replacement => 'FAILLOG_ENAB no', + pattern => '^FAILLOG_ENAB[[:space:]]+yes$', + replacement => "FAILLOG_ENAB\tno", } Line['loginrecords-faillog']{ - line => 'FAILLOG_ENAB no', + line => "FAILLOG_ENAB\tno", } } diff --git a/manifests/faillog/enable.pp b/manifests/faillog/enable.pp index c714b74..d600f6f 100644 --- a/manifests/faillog/enable.pp +++ b/manifests/faillog/enable.pp @@ -1,14 +1,15 @@ +# manage faillog logging class loginrecords::faillog::enable( $login_defs_file = '/etc/login.defs' ) { replace{'loginrecords-faillog': - file => $login_defs_file, - pattern => '^FAILLOG_ENAB[[:space]]+no$', - replacement => 'FAILLOG_ENAB yes', + file => $loginrecords::faillog::enable::login_defs_file, + pattern => '^FAILLOG_ENAB[[:space]]+no$', + replacement => "FAILLOG_ENAB\tyes", } line{'loginrecords-faillog': - file => $login_defs_file, - line => 'FAILLOG_ENAB yes', + file => $loginrecords::faillog::enable::login_defs_file, + line => "FAILLOG_ENAB\tyes", require => Replace['loginrecords-faillog'], } } -- cgit v1.2.3 From 4fe16c0993d0adfe0e652d76177d0f1736e45cf3 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 2 Jan 2013 11:45:03 +0100 Subject: replace old resources with stdlib functions stdlib has the new file_line, which can also do the same as we used replace for in one run. --- README | 2 +- manifests/faillog/disable.pp | 6 +----- manifests/faillog/enable.pp | 13 ++++--------- 3 files changed, 6 insertions(+), 15 deletions(-) (limited to 'manifests/faillog') diff --git a/README b/README index 68cf39b..06f29ea 100644 --- 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 ============= diff --git a/manifests/faillog/disable.pp b/manifests/faillog/disable.pp index 4e1df4e..c55e39e 100644 --- a/manifests/faillog/disable.pp +++ b/manifests/faillog/disable.pp @@ -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", } } diff --git a/manifests/faillog/enable.pp b/manifests/faillog/enable.pp index d600f6f..6120193 100644 --- a/manifests/faillog/enable.pp +++ b/manifests/faillog/enable.pp @@ -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", } } -- cgit v1.2.3