diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/defines/delete_lines.pp | 5 | ||||
-rw-r--r-- | manifests/defines/line.pp | 15 | ||||
-rw-r--r-- | manifests/defines/module_file.pp | 8 |
3 files changed, 17 insertions, 11 deletions
diff --git a/manifests/defines/delete_lines.pp b/manifests/defines/delete_lines.pp new file mode 100644 index 0000000..28d2362 --- /dev/null +++ b/manifests/defines/delete_lines.pp @@ -0,0 +1,5 @@ +define delete_lines($file, $pattern) { + exec { "/bin/sed -i -r -e '/$pattern/d' $file": + onlyif => "/bin/grep -E '$pattern' '$file'", + } +} diff --git a/manifests/defines/line.pp b/manifests/defines/line.pp index ccfa357..bbe0a54 100644 --- a/manifests/defines/line.pp +++ b/manifests/defines/line.pp @@ -14,11 +14,10 @@ # is a more stable solution with less maintenance headaches afterwards. # # Usage: -# line { -# description: -# file => "filename", -# line => "content", -# ensure => {absent,*present*} +# line { description: +# file => "filename", +# line => "content", +# ensure => {absent,*present*} # } # # Example: @@ -34,6 +33,10 @@ # notify => Service[munin-node], # require => Package[munin-node]; # } +# +# Code with fixes gathered at +# http://reductivelabs.com/trac/puppet/wiki/Recipes/SimpleText +>>>>>>> sarava/master define line($file, $line, $ensure = 'present') { case $ensure { default : { err ( "unknown ensure value '${ensure}'" ) } @@ -50,5 +53,3 @@ define line($file, $line, $ensure = 'present') { } } } - - diff --git a/manifests/defines/module_file.pp b/manifests/defines/module_file.pp index 70e5cbf..5977b2d 100644 --- a/manifests/defines/module_file.pp +++ b/manifests/defines/module_file.pp @@ -16,7 +16,7 @@ define module_file ( $source, $ensure = present, - $alias = undef, + $m_alias = undef, $mode = 0644, $owner = root, $group = 0 ) { @@ -25,7 +25,7 @@ define module_file ( "${common::moduledir::module_dir_path}/${name}": source => $source, ensure => $ensure, - alias => $alias, + alias => $m_alias, mode => $mode, owner => $owner, group => $group; } } @@ -34,14 +34,14 @@ define module_file ( define modules_file ( $source, $ensure = present, - $alias = undef, + $m_alias = undef, $mode = 0644, $owner = root, $group = 0 ) { module_file { $name: source => $source, ensure => $ensure, - alias => $alias, + alias => $m_alias, mode => $mode, owner => $owner, group => $group } } |