diff options
author | david <david@f03ff2f1-f02d-0410-970d-b9634babeaa1> | 2007-06-27 06:48:13 +0000 |
---|---|---|
committer | david <david@f03ff2f1-f02d-0410-970d-b9634babeaa1> | 2007-06-27 06:48:13 +0000 |
commit | 0a217790e0c60ee17a3ead9ab290c4b8770318d2 (patch) | |
tree | 2c49fc7a4d6a175ffe4797c80d5cabb14f2202b5 /manifests | |
parent | 1f3cd8ebea24ce28c79ecf4b1efa9356117f9de2 (diff) | |
download | puppet-common-0a217790e0c60ee17a3ead9ab290c4b8770318d2.tar.gz puppet-common-0a217790e0c60ee17a3ead9ab290c4b8770318d2.tar.bz2 |
add a define to handily add parts to a concatenated file
git-svn-id: http://club.black.co.at:82/svn/manifests/trunk@64 f03ff2f1-f02d-0410-970d-b9634babeaa1
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/defines/concatenated_file.pp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/manifests/defines/concatenated_file.pp b/manifests/defines/concatenated_file.pp index 1cfa4fb..96eb92e 100644 --- a/manifests/defines/concatenated_file.pp +++ b/manifests/defines/concatenated_file.pp @@ -4,11 +4,19 @@ # Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at> # See LICENSE for the full license granted to you. +# TODO: +# * get rid of the $dir parameter +# * create the directory in _part too + # Usage: # concatenated_file { "/etc/some.conf": # dir => "/etc/some.conf.d", # } -define concatenated_file ( $dir, $mode = 0644, $owner = root, $group = root ) { +# Use Exec["concat_$name"] as Semaphor +define concatenated_file ( + $dir, $mode = 0644, $owner = root, $group = root + ) +{ file { $dir: ensure => directory, checksum => mtime, @@ -21,7 +29,23 @@ define concatenated_file ( $dir, $mode = 0644, $owner = root, $group = root ) { exec { "find ${dir} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat > ${name}": refreshonly => true, subscribe => File[$dir], + alias => "concat_${name}", } } +# Add a snippet called $name to the concatenated_file at $dir. +# The file can be referenced as File["cf_part_${name}"] +define concatenated_file_part ( + $dir, $content = '', $ensure = present, + $mode = 0644, $owner = root, $group = root + ) +{ + + file { "${dir}/${name}": + ensure => $ensure, content => $content, + mode => $mode, owner => $owner, group => $group, + alias => "cf_part_${name}", + } + +} |