Skip to content

Commit

Permalink
support for multiple notifo users
Browse files Browse the repository at this point in the history
  • Loading branch information
joewilliams committed Jul 13, 2010
1 parent cc33a17 commit eaf9a8d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/deckard/util.rb
Expand Up @@ -49,9 +49,9 @@ def self.alert(priority, subject, body, log, schedule, url)
Deckard::Log.info(log)
elsif priority == 2
begin
if on_call_contacts.has_key?("notifo_username")
Deckard::Log.info("sending notifo alert to #{on_call_contacts["notifo_username"]}")
send_notifo(on_call_contacts["notifo_username"], subject, url)
if on_call_contacts.has_key?("notifo_usernames")
Deckard::Log.info("sending notifo alert to #{on_call_contacts["notifo_usernames"]}")
send_notifo(on_call_contacts["notifo_usernames"], subject, url)
Deckard::Log.info(log)
else
Deckard::Log.info("sending email alert to #{email_to} and sms to #{on_call_contacts["sms_email"]}")
Expand Down Expand Up @@ -104,10 +104,12 @@ def self.send_email(email_addr, subject, body)
end
end

def self.send_notifo(username, subject, url)
def self.send_notifo(usernames, subject, url)
notifo = Notifo.new(Deckard::Config.notifo_user, Deckard::Config.notifo_apikey)
response = notifo.post(username, subject, "deckard alert", url)
Deckard::Log.info("Notifo response: #{response}")
usernames.each do |username|
response = notifo.post(username, subject, "deckard alert", url)
Deckard::Log.info("Notifo response: #{response}")
end
end

def self.schedule(schedule)
Expand Down

0 comments on commit eaf9a8d

Please sign in to comment.