Class: ChefNotifier::Mailer

Inherits:
Chef::Handler
  • Object
show all
Includes:
Singleton
Defined in:
lib/chef-notifier/mail.rb

Instance Method Summary collapse

Instance Method Details

#error(msg) ⇒ Object



26
27
28
# File 'lib/chef-notifier/mail.rb', line 26

def error(msg)
  send_mail(msg)
end

#info(msg) ⇒ Object



30
31
32
# File 'lib/chef-notifier/mail.rb', line 30

def info(msg)
  send_mail(msg, "[Chef INFO #{Socket.gethostname}]")
end

#reportObject



16
17
18
19
20
# File 'lib/chef-notifier/mail.rb', line 16

def report
  message = "#{run_status.formatted_exception}\n"
  message << Array(backtrace).join("\n")
  send_mail(message)
end

#setup(args = {}) ⇒ Object



11
12
13
14
# File 'lib/chef-notifier/mail.rb', line 11

def setup(args={})
  @args = {:delivery => {:method => :sendmail, :arguments => '-i'}}.merge(args)
  self
end

#warn(msg) ⇒ Object



22
23
24
# File 'lib/chef-notifier/mail.rb', line 22

def warn(msg)
  send_mail(msg, "[Chef WARN #{Socket.gethostname}]")
end