From 2ce8ce7cb3f1168cbc835f8056057ac51da6cad0 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Mon, 16 Nov 2015 11:45:11 +0200 Subject: Ensure we strip leading/trailing space from alerts. This allows our configuration file `/etc/custodian/custodian.cfg` to contain something like this, without errors; alerter = file , redis --- lib/custodian/worker.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/custodian/worker.rb b/lib/custodian/worker.rb index 3425881..ef162b2 100644 --- a/lib/custodian/worker.rb +++ b/lib/custodian/worker.rb @@ -281,7 +281,10 @@ module Custodian def do_raise(test) @alerter.split(',').each do |alerter| - log_message("Creating alerter: #{alerter}") + alerter.strip! + log_message("Creating alerter: '#{alerter}'") + + alert = Custodian::AlertFactory.create(alerter, test) target = @settings.alerter_target(alerter) @@ -301,7 +304,9 @@ module Custodian # def do_clear(test) @alerter.split(',').each do |alerter| - log_message("Creating alerter: #{alerter}") + + alerter.strip! + log_message("Creating alerter: '#{alerter}'") alert = Custodian::AlertFactory.create(alerter, test) target = @settings.alerter_target(alerter) @@ -320,7 +325,10 @@ module Custodian # def do_duration(test, duration) @alerter.split(',').each do |alerter| - log_message("Creating alerter: #{alerter}") + + alerter.strip! + log_message("Creating alerter: '#{alerter}'") + alert = Custodian::AlertFactory.create(alerter, test) target = @settings.alerter_target(alerter) -- cgit v1.2.1