foreman/app/models/report_observer.rb @ d97375e0
adb0dfd9 | Ohad Levy | class ReportObserver < ActiveRecord::Observer
|
|
def after_save report
|
|||
if report.error?
|
|||
# found a report with errors
|
|||
5aee7268 | Eric Shamow | # notify via email IF enabled is set to true
|
|
if report.host.disabled?
|
|||
report.logger.warn "#{report.host} is disabled - skipping."
|
|||
next
|
|||
end
|
|||
f4a38198 | Ohad Levy | HostMailer.deliver_error_state(report) if SETTINGS[:failed_report_email_notification]
|
|
adb0dfd9 | Ohad Levy | # add here more actions - e.g. snmp alert etc
|
|
end
|
|||
5aee7268 | Eric Shamow | rescue => e
|
|
report.logger.warn "failed to send failure email notification: #{e}" if report.logger
|
|||
adb0dfd9 | Ohad Levy | end
|
|
end
|