2013-05-09 21:24:22 +02:00
# = = = Class : concat: : setup
#
2010-05-06 23:55:02 +02:00
# Sets up the concat system.
#
2013-05-09 21:24:22 +02:00
# [ $c oncatdir]
# is where the fragments live and is set on the fact concat_basedir.
# Since puppet should always manage files in $c oncatdir and they should
# not be deleted ever, / tmp is not an option.
2010-05-06 23:55:02 +02:00
#
2013-05-09 21:24:22 +02:00
# [ $ puppetversion]
# should be either 2 4 or 2 5 to enable a 2 4 compatible
# mode, in 2 4 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
2013-05-09 21:24:22 +02:00
#
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 {
$c oncatdir = $ : : concat_basedir
} else {
2013-09-27 09:24:58 +02:00
fail ( "\$concat_basedir not defined. Try running again with pluginsync=true on the [master] and/or [main] 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
$f ragments_source = $ majorversion ? {
2 4 = > '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 = > $f ragments_source;
2010-05-06 23:55:02 +02:00
2012-03-14 18:02:43 +01:00
[ $c oncatdir, "${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;
}
2013-09-24 23:12:27 +02:00
# Ensure we run setup first.
Class [ 'concat::setup' ] - > Concat: : Fragment< | | >
2010-05-06 23:55:02 +02:00
}