object_notification.conf.erb 1.9 KB

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