summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-26 10:57:34 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-26 10:57:34 +0000
commitfd80dc9a045e9c939bfb722d2d74a0c379aa4ac8 (patch)
tree63ac95db8c4e063e3f4298db564a026f33d7ae23
parent3a172585f303fb632a932501960c92629414b3e2 (diff)
Ensure we can be loaded, even if there is no redis rubygem present.
-rw-r--r--lib/custodian/alerts/redis-state.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/custodian/alerts/redis-state.rb b/lib/custodian/alerts/redis-state.rb
index 0c0b6a0..1b57b2e 100644
--- a/lib/custodian/alerts/redis-state.rb
+++ b/lib/custodian/alerts/redis-state.rb
@@ -1,7 +1,4 @@
-require 'rubygems'
-require 'redis'
-
#
# The redis-alerter.
@@ -35,6 +32,14 @@ module Custodian
# the redis connection.
#
def initialize( obj )
+
+ begin
+ require 'rubygems'
+ require 'redis'
+ rescue LoadError
+ raise "ERROR Loading redis rubygem!"
+ end
+
@test = obj
@redis = Redis.new
end