diff options
author | Steve Kemp <steve@steve.org.uk> | 2016-04-22 21:54:18 +0300 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2016-04-22 21:54:18 +0300 |
commit | 85a9a63eb5d8690fd7945bba901b10ef8c3326c9 (patch) | |
tree | 7d19fa2c6f951ad9c2537f75c397a9adb94e7372 /lib | |
parent | 67fbf68705e1808107e8cea1d3ab6ad0e206f645 (diff) |
More rubocop fixes.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/custodian/alerts/graphite.rb | 2 | ||||
-rw-r--r-- | lib/custodian/alerts/mauve.rb | 14 | ||||
-rw-r--r-- | lib/custodian/alerts/redis-state.rb | 30 |
3 files changed, 23 insertions, 23 deletions
diff --git a/lib/custodian/alerts/graphite.rb b/lib/custodian/alerts/graphite.rb index 9d69c28..0244047 100644 --- a/lib/custodian/alerts/graphite.rb +++ b/lib/custodian/alerts/graphite.rb @@ -23,7 +23,7 @@ module Custodian # Constructor - save the test-object away. # def initialize(obj) - @test = obj + @test = obj end diff --git a/lib/custodian/alerts/mauve.rb b/lib/custodian/alerts/mauve.rb index 5a00557..be19eec 100644 --- a/lib/custodian/alerts/mauve.rb +++ b/lib/custodian/alerts/mauve.rb @@ -213,7 +213,7 @@ module Custodian test_host = test.target test_type = test.get_type - alert = Mauve::Proto::Alert.new + alert = Mauve::Proto::Alert.new # # Mauve only lets us use IDs which are <= 255 characters in length @@ -234,9 +234,9 @@ module Custodian # # If we're raising then add the error # - if failure + if failure - alert.detail = "<p>The #{test_type} test failed against #{test_host}.</p>" + alert.detail = "<p>The #{test_type} test failed against #{test_host}.</p>" # # The text from the job-defition @@ -246,7 +246,7 @@ module Custodian # # Add the user-detail if present # - alert.detail = "#{alert.detail}<p>#{user_text}</p>" if !user_text.nil? + alert.detail = "#{alert.detail}<p>#{user_text}</p>" if !user_text.nil? # # Add the test-failure message @@ -257,7 +257,7 @@ module Custodian # Determine if this is inside/outside the bytemark network # location = expand_inside_bytemark(test_host) - if !location.nil? && location.length + if !location.nil? && location.length alert.detail = "#{alert.detail}\n#{location}" end end @@ -282,7 +282,7 @@ module Custodian # We'll also make the host a link that can be clicked in the alert we raise. # target = host - if target =~ /^([a-z]+):\/\/([^\/]+)/ + if target =~ /^([a-z]+):\/\/([^\/]+)/ target = $2.dup host = "<a href=\"#{host}\">#{host}</a>" end @@ -339,7 +339,7 @@ module Custodian # Return the formatted message # ips.each do |ipaddr| - if Custodian::Util::Bytemark.inside?(ipaddr.to_s) + if Custodian::Util::Bytemark.inside?(ipaddr.to_s) result += "<p>#{host} resolves to #{ipaddr} which is inside the Bytemark network.</p>" else result += "<p>#{host} resolves to #{ipaddr} which is OUTSIDE the Bytemark network.</p>" diff --git a/lib/custodian/alerts/redis-state.rb b/lib/custodian/alerts/redis-state.rb index 793bb73..2008fee 100644 --- a/lib/custodian/alerts/redis-state.rb +++ b/lib/custodian/alerts/redis-state.rb @@ -71,7 +71,7 @@ module Custodian puts 'ERROR Loading redis rubygem!' end - @test = obj + @test = obj end @@ -88,7 +88,7 @@ module Custodian # test_s = @test.to_s - @redis.sadd( "known_tests", test_s ) + @redis.sadd('known_tests', test_s) # # Get the current state of this test - so that if the state @@ -101,16 +101,16 @@ module Custodian # # The current state # - current = @redis.get( "#{key}.current" ) || "unknown" - @redis.set( "#{key}.current", "FAIL" ) + current = @redis.get("#{key}.current") || 'unknown' + @redis.set("#{key}.current", 'FAIL') - count = @redis.get( "#{key}.count" ) || "0" - @redis.set( "#{key}.count", (count.to_i + 1)) + count = @redis.get("#{key}.count") || '0' + @redis.set("#{key}.count", (count.to_i + 1)) # # Bump the execution count for this test. # - if ( current != "FAIL" ) + if (current != 'FAIL') # # The state has changed to raise. @@ -120,7 +120,7 @@ module Custodian tmp['result'] = 'FAIL' tmp['reason'] = @test.error - @redis.lpush( "#{key}.history", tmp.to_json) + @redis.lpush("#{key}.history", tmp.to_json) @redis.ltrim('#{key}.history', 0, 8192) end @@ -140,7 +140,7 @@ module Custodian # test_s = @test.to_s - @redis.sadd( "known_tests", test_s ) + @redis.sadd('known_tests', test_s) # # Get the current state of this test - so that if the state @@ -153,13 +153,13 @@ module Custodian # # The current state # - current = @redis.get( "#{key}.current" ) || "unknown" - @redis.set( "#{key}.current", "OK" ) + current = @redis.get("#{key}.current") || 'unknown' + @redis.set("#{key}.current", 'OK') - count = @redis.get( "#{key}.count" ) || "0" - @redis.set( "#{key}.count", (count.to_i + 1 )) + count = @redis.get("#{key}.count") || '0' + @redis.set("#{key}.count", (count.to_i + 1)) - if ( current != "OK" ) + if (current != 'OK') # # The state has changed to raise. @@ -169,7 +169,7 @@ module Custodian tmp['result'] = 'OK' tmp['reason'] = @test.error - @redis.lpush( "#{key}.history", tmp.to_json) + @redis.lpush("#{key}.history", tmp.to_json) @redis.ltrim('#{key}.history', 0, 100) end end |