]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/concat/manifests/setup.pp
5e90bfaf937116a181d4a39aecd29db1adbf41af
[dsa-puppet.git] / modules / concat / manifests / setup.pp
1 # Sets up the concat system.
2 #
3 # $concatdir is where the fragments live and is set on the fact concat_basedir.
4 # Since puppet should always manage files in $concatdir and they should
5 # not be deleted ever, /tmp is not an option.
6 #
7 # $puppetversion should be either 24 or 25 to enable a 24 compatible
8 # mode, in 24 mode you might see phantom notifies this is a side effect
9 # of the method we use to clear the fragments directory.
10 #
11 # The regular expression below will try to figure out your puppet version
12 # but this code will only work in 0.24.8 and newer.
13 #
14 # It also copies out the concatfragments.sh file to ${concatdir}/bin
15 class concat::setup {
16   $id = $::id
17   $root_group = $id ? {
18     root    => 0,
19     default => $id
20   }
21
22   if $::concat_basedir {
23     $concatdir = $::concat_basedir
24   } else {
25     fail ("\$concat_basedir not defined. Try running again with pluginsync=true on the [master] section of your node's '/etc/puppet/puppet.conf'.")
26   }
27
28   $majorversion = regsubst($::puppetversion, '^[0-9]+[.]([0-9]+)[.][0-9]+$', '\1')
29   $fragments_source = $majorversion ? {
30     24      => 'puppet:///concat/concatfragments.sh',
31     default => 'puppet:///modules/concat/concatfragments.sh'
32   }
33
34   file{"${concatdir}/bin/concatfragments.sh":
35     owner  => $id,
36     group  => $root_group,
37     mode   => '0755',
38     source => $fragments_source;
39
40   [ $concatdir, "${concatdir}/bin" ]:
41     ensure => directory,
42     owner  => $id,
43     group  => $root_group,
44     mode   => '0750';
45
46   ## Old versions of this module used a different path.
47   '/usr/local/bin/concatfragments.sh':
48     ensure => absent;
49   }
50 }