setup.pp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. $script_name = 'concatfragments.rb'
  26. $script_path = "${concatdir}/bin/${script_name}"
  27. $script_owner = $::osfamily ? { 'windows' => undef, default => $::id }
  28. $script_mode = $::osfamily ? { 'windows' => undef, default => '0755' }
  29. $script_command = $::osfamily? {
  30. 'windows' => "ruby.exe '${script_path}'",
  31. default => $script_path
  32. }
  33. File {
  34. backup => false,
  35. }
  36. file { $script_path:
  37. ensure => file,
  38. owner => $script_owner,
  39. mode => $script_mode,
  40. source => "puppet:///modules/concat/${script_name}",
  41. }
  42. file { [ $concatdir, "${concatdir}/bin" ]:
  43. ensure => directory,
  44. mode => '0755',
  45. }
  46. }