summaryrefslogtreecommitdiff
path: root/lib/custodian/alerts
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-03-09 13:19:15 +0000
committerSteve Kemp <steve@steve.org.uk>2015-03-09 13:19:15 +0000
commitaf2ee063abea8235a8cbd1448533e4f4fbc0d0af (patch)
tree969e448e2d5995f7e838a68ef1d25d54df9b8d29 /lib/custodian/alerts
parentbb2ec1f07af747c69f2fd1e5b70c41b35fb069e6 (diff)
Prefer single-quotes when you don't need interpolation.
So "foo" is less good than 'foo'.
Diffstat (limited to 'lib/custodian/alerts')
-rw-r--r--lib/custodian/alerts/file.rb4
-rw-r--r--lib/custodian/alerts/graphite.rb4
-rw-r--r--lib/custodian/alerts/mauve.rb14
-rw-r--r--lib/custodian/alerts/redis-state.rb42
-rw-r--r--lib/custodian/alerts/smtp.rb4
5 files changed, 34 insertions, 34 deletions
diff --git a/lib/custodian/alerts/file.rb b/lib/custodian/alerts/file.rb
index 5874136..cb04084 100644
--- a/lib/custodian/alerts/file.rb
+++ b/lib/custodian/alerts/file.rb
@@ -55,7 +55,7 @@ module Custodian
# Write the actual message to our target.
#
def write_message( msg )
- file = File.open(@target, "a")
+ file = File.open(@target, 'a')
file.puts( "#{Time.now} #{msg}" )
file.close
@@ -64,7 +64,7 @@ module Custodian
- register_alert_type "file"
+ register_alert_type 'file'
diff --git a/lib/custodian/alerts/graphite.rb b/lib/custodian/alerts/graphite.rb
index 778b36b..c98f6bf 100644
--- a/lib/custodian/alerts/graphite.rb
+++ b/lib/custodian/alerts/graphite.rb
@@ -52,7 +52,7 @@ module Custodian
#
# hostname + test-type
#
- host = @test.target.gsub(/[\/\\.]/, "_")
+ host = @test.target.gsub(/[\/\\.]/, '_')
test = @test.get_type
#
@@ -69,7 +69,7 @@ module Custodian
end
- register_alert_type "graphite"
+ register_alert_type 'graphite'
end
diff --git a/lib/custodian/alerts/mauve.rb b/lib/custodian/alerts/mauve.rb
index 92c38ee..4c20b08 100644
--- a/lib/custodian/alerts/mauve.rb
+++ b/lib/custodian/alerts/mauve.rb
@@ -49,7 +49,7 @@ module Custodian
require 'mauve/proto'
@loaded = true
rescue
- puts "ERROR Loading mauve libraries!"
+ puts 'ERROR Loading mauve libraries!'
@loaded = false
end
end
@@ -96,14 +96,14 @@ module Custodian
#
# Lookup the start of the day.
#
- day_start = @settings.key( "day_start" ).to_i || 10
- day_end = @settings.key( "day_end" ).to_i || 18
+ day_start = @settings.key( 'day_start' ).to_i || 10
+ day_end = @settings.key( 'day_end' ).to_i || 18
#
# In hour suppress
#
- working_suppress = @settings.key( "working_suppress" ).to_i || 4
- oncall_suppress = @settings.key( "oncall_suppress" ).to_i || 10
+ working_suppress = @settings.key( 'working_suppress' ).to_i || 4
+ oncall_suppress = @settings.key( 'oncall_suppress' ).to_i || 10
#
# If we're Monday-Friday, between the start & end time, then
@@ -307,7 +307,7 @@ module Custodian
#
# Did we get an error?
#
- return "" unless !resolved.nil?
+ return '' unless !resolved.nil?
#
@@ -330,7 +330,7 @@ module Custodian
end
- register_alert_type "mauve"
+ register_alert_type 'mauve'
diff --git a/lib/custodian/alerts/redis-state.rb b/lib/custodian/alerts/redis-state.rb
index f37cef2..27bb2c4 100644
--- a/lib/custodian/alerts/redis-state.rb
+++ b/lib/custodian/alerts/redis-state.rb
@@ -39,7 +39,7 @@ module Custodian
@redis = Redis.new(:host => @target )
rescue
- puts "ERROR Loading redis rubygem!"
+ puts 'ERROR Loading redis rubygem!'
end
@test = obj
@@ -55,16 +55,16 @@ module Custodian
return unless( @redis )
tmp = {}
- tmp["time"] = Time.now.to_i
- tmp["type"] = @test.get_type
- tmp["target"] = @test.target
- tmp["result"] = "RAISE"
- tmp["reason"] = @test.error
- tmp["test" ] = @test.to_s
- tmp["class" ] = @test.class
+ tmp['time'] = Time.now.to_i
+ tmp['type'] = @test.get_type
+ tmp['target'] = @test.target
+ tmp['result'] = 'RAISE'
+ tmp['reason'] = @test.error
+ tmp['test' ] = @test.to_s
+ tmp['class' ] = @test.class
- @redis.lpush( "recent-tests", tmp.to_json)
- @redis.ltrim( "recent-tests", 0, 100 )
+ @redis.lpush( 'recent-tests', tmp.to_json)
+ @redis.ltrim( 'recent-tests', 0, 100 )
end
@@ -79,19 +79,19 @@ module Custodian
tmp = {}
- tmp["time"] = Time.now.to_i
- tmp["type"] = @test.get_type
- tmp["target"] = @test.target
- tmp["result"] = "OK"
- tmp["reason"] = ""
- tmp["test" ] = @test.to_s
- tmp["class" ] = @test.class
-
- @redis.lpush( "recent-tests", tmp.to_json)
- @redis.ltrim( "recent-tests", 0, 100 )
+ tmp['time'] = Time.now.to_i
+ tmp['type'] = @test.get_type
+ tmp['target'] = @test.target
+ tmp['result'] = 'OK'
+ tmp['reason'] = ''
+ tmp['test' ] = @test.to_s
+ tmp['class' ] = @test.class
+
+ @redis.lpush( 'recent-tests', tmp.to_json)
+ @redis.ltrim( 'recent-tests', 0, 100 )
end
- register_alert_type "redis"
+ register_alert_type 'redis'
end
end
diff --git a/lib/custodian/alerts/smtp.rb b/lib/custodian/alerts/smtp.rb
index e418031..38ef29e 100644
--- a/lib/custodian/alerts/smtp.rb
+++ b/lib/custodian/alerts/smtp.rb
@@ -62,14 +62,14 @@ Subject: #{subject}
#{body}
END_OF_MESSAGE
- Net::SMTP.start("127.0.0.1") do |smtp|
+ Net::SMTP.start('127.0.0.1') do |smtp|
smtp.send_message( msg, to, to)
end
end
- register_alert_type "smtp"
+ register_alert_type 'smtp'