aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Haerry <haerry@puzzle.ch>2010-05-05 17:26:43 +0200
committerMicah Anderson <micah@riseup.net>2010-09-02 18:17:35 -0400
commitf3dde9f52a2d46f6ca949b87c3d6b15b90b4f6e4 (patch)
tree4866a67593a21688c661c7f022a69c033a37b30e
parentfcb2b08309e7ad18ee58283d754cb41b54fd79d1 (diff)
downloadpuppet-common-f3dde9f52a2d46f6ca949b87c3d6b15b90b4f6e4.tar.gz
puppet-common-f3dde9f52a2d46f6ca949b87c3d6b15b90b4f6e4.tar.bz2
refactoring the last part of moduledirs
-rw-r--r--manifests/defines/concatenated_file.pp5
-rw-r--r--manifests/defines/modules_dir.pp9
-rw-r--r--manifests/init.pp11
-rw-r--r--manifests/moduledir.pp15
-rw-r--r--manifests/moduledir/common.pp3
-rw-r--r--manifests/moduledir/common/cf.pp4
6 files changed, 27 insertions, 20 deletions
diff --git a/manifests/defines/concatenated_file.pp b/manifests/defines/concatenated_file.pp
index d605219..8010c88 100644
--- a/manifests/defines/concatenated_file.pp
+++ b/manifests/defines/concatenated_file.pp
@@ -4,8 +4,6 @@
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
-module_dir { "common/cf": }
-
# TODO:
# * create the directory in _part too
@@ -40,11 +38,12 @@ define concatenated_file (
$mode = 0644, $owner = root, $group = 0
)
{
+ include common::moduledir::common::cf
$dir_real = $dir ? { '' => "${name}.d", default => $dir }
$tmp_file_name = regsubst($dir_real, '/', '_', 'G')
- $tmp_file = "${module_dir_path}/${tmp_file_name}"
+ $tmp_file = "${common::moduledir::module_dir_path}/${tmp_file_name}"
if defined(File[$dir_real]) {
debug("${dir_real} already defined")
diff --git a/manifests/defines/modules_dir.pp b/manifests/defines/modules_dir.pp
index fe0d562..c7cde5b 100644
--- a/manifests/defines/modules_dir.pp
+++ b/manifests/defines/modules_dir.pp
@@ -10,12 +10,13 @@ define modules_dir (
$mode = 0644, $owner = root, $group = 0
)
{
- $dir = "/var/lib/puppet/modules/${name}"
+ include common::moduledir
+ $dir = "$common::moduledir::module_dir_path/${name}"
if defined(File[$dir]) {
debug("${dir} already defined")
} else {
file {
- "/var/lib/puppet/modules/${name}":
+ $dir:
source => [ "puppet://$server/modules/${name}/modules_dir", "puppet://$server/modules/common/empty"],
checksum => mtime,
# ignore the placeholder
@@ -33,7 +34,3 @@ define module_dir (
{
modules_dir{$name: mode => $mode, owner => $owner, group => $group }
}
-
-# Use this variable to reference the base path. Thus you are safe from any
-# changes.
-$module_dir_path = '/var/lib/puppet/modules'
diff --git a/manifests/init.pp b/manifests/init.pp
index b0a8ab2..3770897 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -2,15 +2,4 @@
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
-file {
- # Module programmers can use /var/lib/puppet/modules/$modulename to save
- # module-local data, e.g. for constructing config files
- "/var/lib/puppet/modules":
- ensure => directory,
- source => "puppet://$server/modules/common/modules/",
- ignore => '\.ignore',
- recurse => true, purge => true, force => true,
- mode => 0755, owner => root, group => 0;
-}
-
import "defines/*.pp"
diff --git a/manifests/moduledir.pp b/manifests/moduledir.pp
new file mode 100644
index 0000000..73f8775
--- /dev/null
+++ b/manifests/moduledir.pp
@@ -0,0 +1,15 @@
+class common::moduledir {
+ # Use this variable to reference the base path. Thus you are safe from any
+ # changes.
+ $module_dir_path = '/var/lib/puppet/modules'
+
+ # Module programmers can use /var/lib/puppet/modules/$modulename to save
+ # module-local data, e.g. for constructing config files
+ file{$module_dir_path:
+ ensure => directory,
+ source => "puppet://$server/modules/common/modules/",
+ ignore => '\.ignore',
+ recurse => true, purge => true, force => true,
+ mode => 0755, owner => root, group => 0;
+ }
+}
diff --git a/manifests/moduledir/common.pp b/manifests/moduledir/common.pp
new file mode 100644
index 0000000..c615f84
--- /dev/null
+++ b/manifests/moduledir/common.pp
@@ -0,0 +1,3 @@
+class common::moduledir::common{
+ module_dir{'common': }
+}
diff --git a/manifests/moduledir/common/cf.pp b/manifests/moduledir/common/cf.pp
new file mode 100644
index 0000000..b3c089b
--- /dev/null
+++ b/manifests/moduledir/common/cf.pp
@@ -0,0 +1,4 @@
+class common::moduledir::common::cf {
+ include ::common::moduledir::common
+ module_dir{'common/cf': }
+}