setup.pp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # === Class: concat::setup
  2. #
  3. # Sets up the concat system. This is a private class.
  4. #
  5. # [$concatdir]
  6. # is where the fragments live and is set on the fact concat_basedir.
  7. # Since puppet should always manage files in $concatdir and they should
  8. # not be deleted ever, /tmp is not an option.
  9. #
  10. # It also copies out the concatfragments.{sh,rb} file to ${concatdir}/bin
  11. #
  12. class concat::setup {
  13. if $caller_module_name != $module_name {
  14. warning("${name} is deprecated as a public API of the ${module_name} module and should no longer be directly included in the manifest.")
  15. }
  16. if $::concat_basedir {
  17. $concatdir = $::concat_basedir
  18. } else {
  19. 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\'.')
  20. }
  21. # owner and mode of fragment files (on windows owner and access rights should
  22. # be inherited from concatdir and not explicitly set to avoid problems)
  23. $fragment_owner = $::osfamily ? { 'windows' => undef, default => $::id }
  24. $fragment_mode = $::osfamily ? { 'windows' => undef, default => '0640' }
  25. # PR #174 introduced changes to the concatfragments.sh script that are
  26. # incompatible with Solaris 10 but reportedly OK on Solaris 11. As a work
  27. # around we are enable the .rb concat script on all Solaris versions. If
  28. # this goes smoothly, we should move towards completely eliminating the .sh
  29. # version.
  30. $script_name = $::osfamily? {
  31. /(?i:(Windows|Solaris))/ => 'concatfragments.rb',
  32. default => 'concatfragments.sh'
  33. }
  34. $script_path = "${concatdir}/bin/${script_name}"
  35. $script_owner = $::osfamily ? { 'windows' => undef, default => $::id }
  36. $script_mode = $::osfamily ? { 'windows' => undef, default => '0755' }
  37. $script_command = $::osfamily? {
  38. 'windows' => "ruby.exe '${script_path}'",
  39. default => $script_path
  40. }
  41. File {
  42. backup => false,
  43. }
  44. file { $script_path:
  45. ensure => file,
  46. owner => $script_owner,
  47. mode => $script_mode,
  48. source => "puppet:///modules/concat/${script_name}",
  49. }
  50. file { [ $concatdir, "${concatdir}/bin" ]:
  51. ensure => directory,
  52. mode => '0755',
  53. }
  54. }