aboutsummaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authordavid <david@f03ff2f1-f02d-0410-970d-b9634babeaa1>2007-08-06 10:14:15 +0000
committerdavid <david@f03ff2f1-f02d-0410-970d-b9634babeaa1>2007-08-06 10:14:15 +0000
commitc85903a0b309299183c3fd58d53121a0df059e67 (patch)
tree99694e60b5d2151d2a0f4b74844e653f92aba5db /manifests
parentf7c440572b6b889770805f78f6ff903b98857fbb (diff)
downloadpuppet-common-c85903a0b309299183c3fd58d53121a0df059e67.tar.gz
puppet-common-c85903a0b309299183c3fd58d53121a0df059e67.tar.bz2
support a header file
git-svn-id: http://club.black.co.at:82/svn/manifests/trunk@173 f03ff2f1-f02d-0410-970d-b9634babeaa1
Diffstat (limited to 'manifests')
-rw-r--r--manifests/defines/concatenated_file.pp11
1 files changed, 9 insertions, 2 deletions
diff --git a/manifests/defines/concatenated_file.pp b/manifests/defines/concatenated_file.pp
index 625cff7..7162970 100644
--- a/manifests/defines/concatenated_file.pp
+++ b/manifests/defines/concatenated_file.pp
@@ -14,7 +14,11 @@
# }
# Use Exec["concat_$name"] as Semaphor
define concatenated_file (
- $dir, $mode = 0644, $owner = root, $group = root
+ # where the snippets are located
+ $dir,
+ # a file with content to prepend
+ $header = '',
+ $mode = 0644, $owner = root, $group = root
)
{
file {
@@ -29,8 +33,11 @@ define concatenated_file (
mode => $mode, owner => $owner, group => $group;
}
+ # if there is a header file, prepend it
+ $header_cmd = $header? { '' => '', default => "| cat ${header} - " }
+
# use >| to force clobbering the target file
- exec { "/usr/bin/find ${dir} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat >| ${name}":
+ exec { "/usr/bin/find ${dir} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat ${header_cmd} >| ${name}.puppettmp":
refreshonly => true,
subscribe => File[$dir],
before => File[$name],