object_apply_notification_to_host.conf.erb 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * WARNING: This service definition is automatically generated by Puppet.
  3. * ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN!
  4. */
  5. /**
  6. * A object definition that applys notifications to hosts. You can create your
  7. * own configuration files in the conf.d directory (e.g. one per host).
  8. * By default all *.conf files in this directory are included.
  9. *
  10. */
  11. apply Notification "<%= @object_notificationname %>" to Host {
  12. <%#- If any of the @ parameters are undefined, don't print anything for them: -%>
  13. <%- if @notification_to_import -%>
  14. <%#- Otherwise, include the parameter: -%>
  15. import "<%= @notification_to_import %>"
  16. <%- end -%>
  17. <%- if @assign_where -%>
  18. assign where <%= @assign_where %>
  19. <%- end -%>
  20. <%- if @ignore_where -%>
  21. ignore where <%= @ignore_where %>
  22. <%- end -%>
  23. <%- if @command -%>
  24. command = "<%= @command %>"
  25. <%- end -%>
  26. <%- if @vars.empty? != true -%>
  27. <%- @vars.sort_by {|key, value| key}.each do |key, value| -%>
  28. <%= key %> = <% if value.class == String %><%= value %>
  29. <%- else -%>{
  30. <%- value.sort_by {|k, v| k}.each do |k, v| -%>
  31. <%= k %> = <%= v %>
  32. <%- end -%>
  33. }
  34. <%- end -%>
  35. <%- end -%>
  36. <%- end -%>
  37. <%- if @users.empty? !=true -%>
  38. users = [ <% @users.each_with_index do |usr, i| %>"<%= usr -%>"<%= ', ' if i < (@users.size - 1) %><% end %> ]
  39. <%- end -%>
  40. <%- if @user_groups.empty? !=true -%>
  41. user_groups = [ <% @user_groups.each_with_index do |u_grp, i| %>"<%= u_grp -%>"<%= ', ' if i < (@user_groups.size - 1) %><% end %> ]
  42. <%- end -%>
  43. <%- if @times.empty? != true -%>
  44. times = {
  45. <%- @times.sort_by {|key, value| key}.each do |key, value| -%>
  46. <%= key %> = "<%= value %>"
  47. <%- end -%>
  48. }
  49. <%- end -%>
  50. <%- if @interval -%>
  51. interval = "<%= @interval -%>"
  52. <%- end -%>
  53. <%- if @period -%>
  54. period = "<%= @period -%>"
  55. <%- end -%>
  56. <%- if @types.empty? !=true -%>
  57. types = [ <% @types.each_with_index do |typ, i| %><%= typ -%><%= ', ' if i < (@types.size - 1) %><% end %> ]
  58. <%- end -%>
  59. <%- if @states.empty? !=true -%>
  60. states = [ <% @states.each_with_index do |state, i| %><%= state -%><%= ', ' if i < (@states.size - 1) %><% end %> ]
  61. <%- end -%>
  62. }