Project

General

Profile

« Previous | Next » 

Revision b2ef897d

Added by Ohad Levy over 14 years ago

  • ID b2ef897dc3f4390d4a4057923849d49332e76ab2

fixes #71 - send out daily email summary of puppet changes

View differences:

lib/tasks/reports.rake
Report.expire(conditions)
end
end
desc <<-END_DESC
Send an email summarizing hosts reports (and lack of it).
Available conditions:
* days => number of days to scan backwards (defaults to 1)
* hours => number of hours to scan backwards (defaults to disabled)
Example:
rake reports:summarise days=3 RAILS_ENV="production" # Sends out a summary email for the last 3 days.
rake reports:summarise hours=12 RAILS_ENV="production" # Sends out a summary email for the last 12 hours.
END_DESC
namespace :reports do
task :summarise => :environment do
time = ENV['hours'].to_i.hours.ago if ENV['hours']
time = ENV['days'].to_i.days.ago if ENV['days']
time = 1.days.ago unless time
HostMailer.deliver_summary(time, Host.all)
end
end

Also available in: Unified diff