diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-11-16 11:45:11 +0200 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-11-16 11:45:11 +0200 |
commit | 2ce8ce7cb3f1168cbc835f8056057ac51da6cad0 (patch) | |
tree | 01965dae473ce485020fc023b0d761c043eb08ee /lib/custodian/worker.rb | |
parent | 320e4f92d5d4a7810f56eb1a70ea7bb06f3167cc (diff) |
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
Diffstat (limited to 'lib/custodian/worker.rb')
-rw-r--r-- | lib/custodian/worker.rb | 14 |
1 files 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) |