module-concat/manifests/setup.pp
Toni Schmidbauer 4fc1dfc462 use concatfragments.rb on AIX
AIX find does not support the print0 option. It's basically the same as on Solaris:

Debug: Executing '/var/lib/puppet/concat/bin/concatfragments.sh -o "/var/lib/puppet/concat/_var_ossec_etc_ossec-agent.conf/fragments.concat.out" -d "/var/lib/puppet/concat/_var_ossec_etc_ossec-agent.conf" -t'
Debug: /Stage[main]/Ossec::Client/Concat[/var/ossec/etc/ossec-agent.conf]/Exec[concat_/var/ossec/etc/ossec-agent.conf]/unless: find: bad option -print0
2014-11-18 13:55:53 +01:00

64 lines
2.2 KiB
Puppet

# === Class: concat::setup
#
# Sets up the concat system. This is a private class.
#
# [$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.
#
# It also copies out the concatfragments.{sh,rb} file to ${concatdir}/bin
#
class concat::setup {
if $caller_module_name != $module_name {
warning("${name} is deprecated as a public API of the ${module_name} module and should no longer be directly included in the manifest.")
}
if $::concat_basedir {
$concatdir = $::concat_basedir
} else {
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\'.')
}
# owner and mode of fragment files (on windows owner and access rights should
# be inherited from concatdir and not explicitly set to avoid problems)
$fragment_owner = $::osfamily ? { 'windows' => undef, default => $::id }
$fragment_mode = $::osfamily ? { 'windows' => undef, default => '0640' }
# PR #174 introduced changes to the concatfragments.sh script that are
# incompatible with Solaris 10 but reportedly OK on Solaris 11. As a work
# around we are enable the .rb concat script on all Solaris versions. If
# this goes smoothly, we should move towards completely eliminating the .sh
# version.
$script_name = $::osfamily? {
/(?i:(Windows|Solaris|AIX))/ => 'concatfragments.rb',
default => 'concatfragments.sh'
}
$script_path = "${concatdir}/bin/${script_name}"
$script_owner = $::osfamily ? { 'windows' => undef, default => $::id }
$script_mode = $::osfamily ? { 'windows' => undef, default => '0755' }
$script_command = $::osfamily? {
'windows' => "ruby.exe '${script_path}'",
default => $script_path
}
File {
backup => false,
}
file { $script_path:
ensure => file,
owner => $script_owner,
mode => $script_mode,
source => "puppet:///modules/concat/${script_name}",
}
file { [ $concatdir, "${concatdir}/bin" ]:
ensure => directory,
mode => '0755',
}
}