Guest User

Untitled

a guest
Nov 21st, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. #######################################################################
  2. ###
  3. ### Filesystem checks
  4. ###
  5. <% if $nhc::check_fs_mount { -%>
  6. <% $nhc::check_fs_mount.each |$fs_struct| { -%>
  7. <%
  8. $function = $fs_struct['fs_mode'] ? {
  9. 'ro' => 'check_fs_mount_ro',
  10. 'rw' => 'check_fs_mount_rw',
  11. default => 'check_fs_mount'
  12. }
  13. $nonfatal = $fs_struct['nonfatal'] ? {
  14. true => '-0',
  15. default => undef
  16. }
  17. $remount = $fs_struct['remount'] ? {
  18. true => '-r',
  19. default => undef
  20. }
  21. $options = $fs_struct['options'] ? {
  22. true => "-o ${fs_struct['options']}",
  23. default => undef
  24. }
  25. $mount_opts = $fs_struct['mount_opts'] ? {
  26. true => "-O ${fs_struct['mount_opts']}",
  27. default => undef
  28. }
  29. $notfound_cmd = $fs_struct['notfound_cmd'] ? {
  30. true => "-e ${fs_struct['notfound_cmd']}",
  31. default => undef
  32. }
  33. $found_cmd = $fs_struct['found_cmd'] ? {
  34. true => "-E ${fs_struct['found_cmd']}",
  35. default => undef
  36. }
  37. $fs_name = "-f ${fs_struct['fs_name']}"
  38. $fs_type = $fs_struct['fs_type'] ? {
  39. true => "-t ${fs_struct['fs_type']}",
  40. default => undef
  41. }
  42. $fs_source = $fs_struct['fs_source'] ? {
  43. true => "-s ${fs_struct['fs_source']}",
  44. default => undef
  45. }
  46. $formats = {
  47. String => {
  48. "format" => "% s",
  49. "string_formats" => {
  50. String => "%s"
  51. }
  52. },
  53. String[0,0] => {
  54. "format" => "% p",
  55. "string_formats" => {
  56. String => "%s"
  57. }
  58. },
  59. Array => {
  60. format => '% a',
  61. separator => '',
  62. string_formats => {
  63. String => '%t',
  64. }
  65. },
  66. Undef => {
  67. "format" => "% s",
  68. "string_formats" => {
  69. String => "%s"
  70. }
  71. }
  72. }
  73. $filtered_fs = [
  74. $function,
  75. $nonfatal,
  76. $remount,
  77. $fs_source,
  78. $fs_type,
  79. $options,
  80. $mount_opts,
  81. $notfound_cmd,
  82. $found_cmd,
  83. $fs_name,
  84. ].filter |$item| { $item =~ NotUndef }
  85. $final_fs = String($filtered_fs,$formats)
  86. -%>
  87. * || <%= $final_fs %>
  88. <% } -%>
  89. <% } -%>
  90.  
  91. puppet agent -t results(note the square brackets, shouldn't be there):
  92. * || ['check_fs_mount_rw', '-f /']
  93. * || ['check_fs_mount_rw', '-f /tmp']
  94. * || ['check_fs_mount_rw', '-f /localscratch']
  95. * || ['check_fs_mount', '-f /opt/software']
  96. * || ['check_fs_mount_rw', '-f /home']
  97. * || ['check_fs_mount_rw', '-f /project']
  98. * || ['check_fs_mount_rw', '-f /scratch']
  99. * || ['check_fs_mount_rw', '-f /cvmfs']
  100.  
  101. puppet apply results:
  102. * || check_fs_mount_rw -f /
  103. * || check_fs_mount_rw -f /tmp
  104. * || check_fs_mount_rw -f /localscratch
  105. * || check_fs_mount -f /opt/software
  106. * || check_fs_mount_rw -f /home
  107. * || check_fs_mount_rw -f /project
  108. * || check_fs_mount_rw -f /scratch
  109. * || check_fs_mount_rw -f /cvmfs
Add Comment
Please, Sign In to add comment