diff options
author | David Schmitt <david@schmitt.edv-bus.at> | 2009-05-31 21:14:37 +0200 |
---|---|---|
committer | David Schmitt <david@schmitt.edv-bus.at> | 2009-05-31 21:14:37 +0200 |
commit | 53d0fde15feb30777a6929cada73d5f6e6ceb513 (patch) | |
tree | 1c81f431393991beabff6011a337dce2d0d76931 /manifests/defines/module_dir.pp | |
parent | 9a2c68367f8ac75ce52e315253d28f6710a80702 (diff) | |
download | puppet-common-53d0fde15feb30777a6929cada73d5f6e6ceb513.tar.gz puppet-common-53d0fde15feb30777a6929cada73d5f6e6ceb513.tar.bz2 |
Major cleanup of the common module
* improve documentation on all defines
* rename modules_dir to module_dir and modules_file to module_file
* create $module_dir_path to achieve DRY-ness
* silence the lsb_release stuff
* improve concatenated_file to use an intermediate file, improving reliability
and decoupling the updateing from notifying our peers.
* remove serveral functions that were moved to puppet proper:
- sha1 => sha1
- gsub,substitute,slash_escape => regsubst
Diffstat (limited to 'manifests/defines/module_dir.pp')
-rw-r--r-- | manifests/defines/module_dir.pp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/manifests/defines/module_dir.pp b/manifests/defines/module_dir.pp new file mode 100644 index 0000000..712e611 --- /dev/null +++ b/manifests/defines/module_dir.pp @@ -0,0 +1,43 @@ +# common/manifests/defines/module_dir.pp -- create a default directory +# for storing module specific information +# +# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at> +# See LICENSE for the full license granted to you. + +# Use this variable to reference the base path. Thus you are safe from any +# changes. +$module_dir_path = '/var/lib/puppet/modules' + +# A module_dir is a storage place for all the stuff a module might want to +# store. According to the FHS, this should go to /var/lib. Since this is a part +# of puppet, the full path is /var/lib/puppet/modules/${name}. Every module +# should # prefix its module_dirs with its name. +# +# By default, the module_dir is loaded from "puppet:///${name}/module_dir". If +# that doesn't exist an empty directory is taken as template. The directory is +# purged so that modules do not have to worry about removing cruft. +# +# Usage: +# module_dir { ["common", "common/dir1", "common/dir2" ]: } +define module_dir ( + $mode = 0644, + $owner = root, + $group = 0 + ) +{ + $dir = "${module_dir_path}/${name}" + if defined(File[$dir]) { + debug("${dir} already defined") + } else { + file { + $dir: + source => [ "puppet:///${name}/module_dir", "puppet:///common/empty"], + checksum => mtime, + # ignore the placeholder + ignore => '\.ignore', + recurse => true, purge => true, force => true, + mode => $mode, owner => $owner, group => $group; + } + } +} + |