refactor modules_dir and modules_file to remove plural (deprecated in David Schmitt's version) and adjust module_file to new module_dir structure

This commit is contained in:
Jerome Charaoui 2010-05-07 17:13:48 -04:00 committed by Micah Anderson
parent 109311524e
commit 1379f6cba1
3 changed files with 38 additions and 29 deletions

View file

@ -6,16 +6,16 @@
# Usage:
# include common::moduledir
# modules_dir { ["common", "common/dir1", "common/dir2" ]: }
# module_dir { ["common", "common/dir1", "common/dir2" ]: }
#
# You may refer to a file in module_dir by using :
# file { "${common::moduledir::module_dir_path}/somedir/somefile": }
define modules_dir (
define module_dir (
$mode = 0644, $owner = root, $group = 0
)
{
include common::moduledir
include common::moduledir
$dir = "$common::moduledir::module_dir_path/${name}"
if defined(File[$dir]) {
debug("${dir} already defined")
@ -33,9 +33,9 @@ define modules_dir (
}
# alias for compatibility
define module_dir (
define modules_dir (
$mode = 0644, $owner = root, $group = 0
)
{
modules_dir{$name: mode => $mode, owner => $owner, group => $group }
module_dir { $name: mode => $mode, owner => $owner, group => $group }
}

View file

@ -0,0 +1,33 @@
# common/manifests/defines/modules_file.pp -- use a modules_dir to store module
# specific files
#
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# Usage:
# modules_file { "module/file":
# source => "puppet://${server}/...",
# mode => 644, # default
# owner => root, # default
# group => 0, # default
# }
define module_file (
$source,
$mode = 0644, $owner = root, $group = 0
)
{
include common::moduledir
file {
"${common::moduledir::module_dir_path}/${name}":
source => $source,
mode => $mode, owner => $owner, group => $group;
}
}
# alias for compatibility
define modules_file (
$source, $mode = 0644, $owner = root, $group = 0
)
{
module_file { $name: source => $source, mode => $mode, owner => $owner, group => $group }
}

View file

@ -1,24 +0,0 @@
# common/manifests/defines/modules_file.pp -- use a modules_dir to store module
# specific files
#
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# Usage:
# modules_file { "module/file":
# source => "puppet://..",
# mode => 644, # default
# owner => root, # default
# group => root, # default
# }
define modules_file (
$source,
$mode = 0644, $owner = root, $group = root
)
{
file {
"/var/lib/puppet/modules/${name}":
source => $source,
mode => $mode, owner => $owner, group => $group;
}
}