From 9a681d96d8b2765b4dc1483ea348c8c1b2d223b5 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood Date: Thu, 24 Dec 2009 11:18:50 +1100 Subject: [PATCH] don't use a global list of recipients, as they'll be passed in when a notification needs to be sent --- lib/flapjack/notifier_engine.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/flapjack/notifier_engine.rb b/lib/flapjack/notifier_engine.rb index 2aefe655b..6e95c4c07 100644 --- a/lib/flapjack/notifier_engine.rb +++ b/lib/flapjack/notifier_engine.rb @@ -5,12 +5,11 @@ module Flapjack class NotifierEngine - attr_reader :recipients, :log, :notifiers + attr_reader :log, :notifiers def initialize(opts={}) @log = opts[:log] raise "you have to specify a logger" unless @log - @recipients = (opts[:recipients] || []) @notifiers = [] if opts[:notifiers] @@ -24,14 +23,15 @@ def initialize(opts={}) end def notify!(options={}) - result = options[:result] - event = options[:event] + result = options[:result] + event = options[:event] + recipients = options[:recipients] raise ArgumentError, "A result + event were not passed!" unless result && event @notifiers.each do |n| - @recipients.each do |recipient| - @log.info("Notifying #{recipient.name} via #{n.class} about check #{result.id}") + recipients.each do |recipient| + @log.info("Notifying #{recipient.name} via #{n.class} about check #{result.check_id}") n.notify(:result => result, :who => recipient, :event => event) end end