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
commit91713ef347d49dca7de7dd9360d42763dd961894 (patch)
tree99f8d3e0ff368cc7bb863cdf7910ffcc629774d4 /lib/custodian/protocoltest/ssl.rb
parent1b9654c79d6bd8e24134ddeef4bf44580a726178 (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