2010-05-06 23:55:02 +02:00
|
|
|
# Sets up the concat system.
|
|
|
|
#
|
2012-05-20 20:24:22 +02:00
|
|
|
# $concatdir is where the fragments live and is set on the fact concat_basedir.
|
|
|
|
# Since puppet should always manage files in $concatdir and they should
|
|
|
|
# not be deleted ever, /tmp is not an option.
|
2010-05-06 23:55:02 +02:00
|
|
|
#
|
|
|
|
# $puppetversion should be either 24 or 25 to enable a 24 compatible
|
|
|
|
# mode, in 24 mode you might see phantom notifies this is a side effect
|
|
|
|
# of the method we use to clear the fragments directory.
|
2011-12-14 22:45:06 +01:00
|
|
|
#
|
2010-05-06 23:55:02 +02:00
|
|
|
# The regular expression below will try to figure out your puppet version
|
|
|
|
# but this code will only work in 0.24.8 and newer.
|
|
|
|
#
|
2011-12-14 22:45:06 +01:00
|
|
|
# It also copies out the concatfragments.sh file to ${concatdir}/bin
|
2010-05-06 23:55:02 +02:00
|
|
|
class concat::setup {
|
2012-03-14 18:02:43 +01:00
|
|
|
$id = $::id
|
|
|
|
$root_group = $id ? {
|
|
|
|
root => 0,
|
|
|
|
default => $id
|
|
|
|
}
|
2012-05-23 23:35:08 +02:00
|
|
|
|
|
|
|
if $::concat_basedir {
|
|
|
|
$concatdir = $::concat_basedir
|
|
|
|
} else {
|
2013-02-24 12:28:19 +01:00
|
|
|
fail ("\$concat_basedir not defined. Try running again with pluginsync=true on the [master] section of your node's '/etc/puppet/puppet.conf'.")
|
2012-05-23 23:35:08 +02:00
|
|
|
}
|
|
|
|
|
2012-03-14 18:02:43 +01:00
|
|
|
$majorversion = regsubst($::puppetversion, '^[0-9]+[.]([0-9]+)[.][0-9]+$', '\1')
|
2012-08-30 12:33:50 +02:00
|
|
|
$fragments_source = $majorversion ? {
|
|
|
|
24 => 'puppet:///concat/concatfragments.sh',
|
|
|
|
default => 'puppet:///modules/concat/concatfragments.sh'
|
|
|
|
}
|
2010-05-06 23:55:02 +02:00
|
|
|
|
2012-03-14 18:02:43 +01:00
|
|
|
file{"${concatdir}/bin/concatfragments.sh":
|
|
|
|
owner => $id,
|
|
|
|
group => $root_group,
|
|
|
|
mode => '0755',
|
2012-08-30 12:33:50 +02:00
|
|
|
source => $fragments_source;
|
2010-05-06 23:55:02 +02:00
|
|
|
|
2012-03-14 18:02:43 +01:00
|
|
|
[ $concatdir, "${concatdir}/bin" ]:
|
|
|
|
ensure => directory,
|
|
|
|
owner => $id,
|
|
|
|
group => $root_group,
|
|
|
|
mode => '0750';
|
2011-12-14 22:45:06 +01:00
|
|
|
|
2012-03-14 18:02:43 +01:00
|
|
|
## Old versions of this module used a different path.
|
|
|
|
'/usr/local/bin/concatfragments.sh':
|
|
|
|
ensure => absent;
|
|
|
|
}
|
2010-05-06 23:55:02 +02:00
|
|
|
}
|