summaryrefslogtreecommitdiff
path: root/lib/custodian/protocoltest/ssl.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-04-16 16:14:06 +0100
committerSteve Kemp <steve@steve.org.uk>2015-04-16 16:14:06 +0100
commitc31a047c7ecf949b3cf8369985946f563957bf0a (patch)
treedaa4a5bc7db319540d31c873a32f7c58b411f8b3 /lib/custodian/protocoltest/ssl.rb
parent3d15acf163a514816f3d2e2d08730dfb708fe5fd (diff)
Updated test-handler for new API.
This update consists of two changes: * No longer return "true" or "false" instead return "TEST_FAILED", or "TEST_SUCCEEDED". * Removed the testing of test-inversion from the class, now it lives in the base-class where it should have done all along.
Diffstat (limited to 'lib/custodian/protocoltest/ssl.rb')
-rw-r--r--lib/custodian/protocoltest/ssl.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/custodian/protocoltest/ssl.rb b/lib/custodian/protocoltest/ssl.rb
index f2baf67..cc36652 100644
--- a/lib/custodian/protocoltest/ssl.rb
+++ b/lib/custodian/protocoltest/ssl.rb
@@ -162,7 +162,7 @@ class SSLCheck
# Setup a hostname for SNI-purposes.
begin
s.hostname = uri.host
- rescue NoMethodError => err
+ rescue NoMethodError => _err
# SNI isn't possible, as the SSL library is too old.
end
@@ -391,7 +391,7 @@ module Custodian
# If the line disables us then return early
#
if @line =~ /no_ssl_check/
- return true
+ return Custodian::TestResult::TEST_PASSED
end
@@ -405,7 +405,7 @@ module Custodian
#
if hour < 10 || hour > 17
puts("Outside office hours - Not running SSL-Verification of #{@host}")
- return true
+ return Custodian::TestResult::TEST_SKIPPED
end
#
@@ -413,7 +413,7 @@ module Custodian
#
if ! @host =~ /^https:\/\//
puts('Not an SSL URL')
- return true
+ return Custodian::TestResult::TEST_SKIPPED
end
s = SSLCheck.new(@host)
@@ -421,15 +421,15 @@ module Custodian
if true == result
puts("SSL Verification succeeded for #{@host}")
- return true
+ return Custodian::TestResult::TEST_PASSED
elsif result.nil?
puts("SSL Verification returned no result (timeout?) #{@host}")
- return true
+ return Custodian::TestResult::TEST_PASSED
else
puts("SSL Verification for #{@host} has failed.")
@error = "SSL Verification for #{@host} failed: "
@error += s.errors.join("\n")
- return false
+ return Custodian::TestResult::TEST_FAILED
end
end