summaryrefslogtreecommitdiff
path: root/lib/custodian/protocoltest
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-03-09 13:19:47 +0000
committerSteve Kemp <steve@steve.org.uk>2015-03-09 13:19:47 +0000
commite716a49dabe2c086a97e2d8b3cffe5cf369ad026 (patch)
treee7e98125f89941db4c9d0f48f2df9c410467a3d8 /lib/custodian/protocoltest
parentaf2ee063abea8235a8cbd1448533e4f4fbc0d0af (diff)
Removed spaces inside parenthesis.
Diffstat (limited to 'lib/custodian/protocoltest')
-rw-r--r--lib/custodian/protocoltest/dns.rb26
-rw-r--r--lib/custodian/protocoltest/dnsbl.rb12
-rw-r--r--lib/custodian/protocoltest/ftp.rb6
-rw-r--r--lib/custodian/protocoltest/http.rb12
-rw-r--r--lib/custodian/protocoltest/imap.rb6
-rw-r--r--lib/custodian/protocoltest/jabber.rb6
-rw-r--r--lib/custodian/protocoltest/ldap.rb8
-rw-r--r--lib/custodian/protocoltest/mx.rb8
-rw-r--r--lib/custodian/protocoltest/mysql.rb6
-rw-r--r--lib/custodian/protocoltest/named.rb6
-rw-r--r--lib/custodian/protocoltest/openproxy.rb8
-rw-r--r--lib/custodian/protocoltest/ping.rb18
-rw-r--r--lib/custodian/protocoltest/pop3.rb6
-rw-r--r--lib/custodian/protocoltest/postgresql.rb6
-rw-r--r--lib/custodian/protocoltest/redis.rb6
-rw-r--r--lib/custodian/protocoltest/rsync.rb6
-rw-r--r--lib/custodian/protocoltest/smtp.rb6
-rw-r--r--lib/custodian/protocoltest/smtprelay.rb10
-rw-r--r--lib/custodian/protocoltest/ssh.rb6
-rw-r--r--lib/custodian/protocoltest/ssl.rb16
-rw-r--r--lib/custodian/protocoltest/tcp.rb28
-rw-r--r--lib/custodian/protocoltest/telnet.rb6
22 files changed, 109 insertions, 109 deletions
diff --git a/lib/custodian/protocoltest/dns.rb b/lib/custodian/protocoltest/dns.rb
index 7f4b997..add4a87 100644
--- a/lib/custodian/protocoltest/dns.rb
+++ b/lib/custodian/protocoltest/dns.rb
@@ -37,7 +37,7 @@ module Custodian
#
# Constructor
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -64,15 +64,15 @@ module Custodian
#
# Ensure we had all the data.
#
- raise ArgumentError, 'Missing host to resolve' unless( @resolve_name )
- raise ArgumentError, 'Missing type of record to lookup' unless( @resolve_type )
- raise ArgumentError, 'Missing expected results' unless( @resolve_expected )
- raise ArgumentError, "Uknown record type: #{@resolve_type}" unless( @resolve_type =~ /^(A|NS|MX|AAAA)$/ )
+ raise ArgumentError, 'Missing host to resolve' unless(@resolve_name)
+ raise ArgumentError, 'Missing type of record to lookup' unless(@resolve_type)
+ raise ArgumentError, 'Missing expected results' unless(@resolve_expected)
+ raise ArgumentError, "Uknown record type: #{@resolve_type}" unless(@resolve_type =~ /^(A|NS|MX|AAAA)$/)
#
# The host to query against
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
end
@@ -106,7 +106,7 @@ module Custodian
#
# Do the lookup
#
- results = resolve_via( @host, resolve_type, resolve_name, period )
+ results = resolve_via(@host, resolve_type, resolve_name, period)
return false if results.nil?
#
@@ -126,12 +126,12 @@ module Custodian
#
# Resolve an IP
#
- def resolve_via( server, ltype, name, period )
+ def resolve_via(server, ltype, name, period)
results = []
begin
- timeout( period ) do
+ timeout(period) do
begin
#
@@ -147,16 +147,16 @@ module Custodian
case ltype
when /^A$/ then
- dns.getresources(name, Resolv::DNS::Resource::IN::A).map{ |r| results.push( r.address.to_s ) }
+ dns.getresources(name, Resolv::DNS::Resource::IN::A).map{ |r| results.push(r.address.to_s) }
when /^AAAA$/ then
- dns.getresources(name, Resolv::DNS::Resource::IN::AAAA).map{ |r| results.push( r.address.to_s ) }
+ dns.getresources(name, Resolv::DNS::Resource::IN::AAAA).map{ |r| results.push(r.address.to_s) }
when /^NS$/ then
- dns.getresources(name, Resolv::DNS::Resource::IN::NS).map{ |r| results.push( Resolv.getaddresses( r.name.to_s ) ) }
+ dns.getresources(name, Resolv::DNS::Resource::IN::NS).map{ |r| results.push(Resolv.getaddresses(r.name.to_s)) }
when /^MX$/ then
- dns.getresources(name, Resolv::DNS::Resource::IN::MX).map{ |r| results.push( Resolv.getaddresses( r.exchange.to_s ) ) }
+ dns.getresources(name, Resolv::DNS::Resource::IN::MX).map{ |r| results.push(Resolv.getaddresses(r.exchange.to_s)) }
else
@error = "Unknown record type to resolve: '#{ltype}'"
diff --git a/lib/custodian/protocoltest/dnsbl.rb b/lib/custodian/protocoltest/dnsbl.rb
index d307470..6d55260 100644
--- a/lib/custodian/protocoltest/dnsbl.rb
+++ b/lib/custodian/protocoltest/dnsbl.rb
@@ -24,14 +24,14 @@ module Custodian
#
# Save away state from the configuration line.
#
- def initialize( line )
+ def initialize(line)
@line = line
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
# Ensure the host is an IP address.
#
- raise ArgumentError, 'The target must be an IP address' unless( @host =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/ )
+ raise ArgumentError, 'The target must be an IP address' unless(@host =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/)
#
# See which blacklist(s) we're testing against.
@@ -73,7 +73,7 @@ module Custodian
# The error is empty.
@error = nil
- @zones.split( ',' ).each do |zone|
+ @zones.split(',').each do |zone|
#
# Convert the IP to be looked up.
@@ -85,9 +85,9 @@ module Custodian
name = "#{$4}.#{$3}.#{$2}.#{$1}.#{zone}"
- result = Custodian::Util::DNS.hostname_to_ip( name )
+ result = Custodian::Util::DNS.hostname_to_ip(name)
- if ( !result.nil? ) && ( result.length > 0 )
+ if (!result.nil?) && (result.length > 0)
@error = "IP #{@host} listed in blacklist #{zone}. Lookup of #{name} lead to result: #{result}"
return true
end
diff --git a/lib/custodian/protocoltest/ftp.rb b/lib/custodian/protocoltest/ftp.rb
index 921de62..ddefe45 100644
--- a/lib/custodian/protocoltest/ftp.rb
+++ b/lib/custodian/protocoltest/ftp.rb
@@ -21,7 +21,7 @@ module Custodian
#
# Constructor
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -31,7 +31,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
if @host =~ /^ftp:\/\/([^\/]+)\/?/
@host = $1.dup
end
@@ -76,7 +76,7 @@ module Custodian
# reset the error, in case we were previously executed.
@error = nil
- run_test_internal( @host, @port, /^220/, true )
+ run_test_internal(@host, @port, /^220/, true)
end
diff --git a/lib/custodian/protocoltest/http.rb b/lib/custodian/protocoltest/http.rb
index 6ed3c5b..7bbc3e2 100644
--- a/lib/custodian/protocoltest/http.rb
+++ b/lib/custodian/protocoltest/http.rb
@@ -38,7 +38,7 @@ module Custodian
#
# Constructor
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -48,7 +48,7 @@ module Custodian
#
# Save the URL
#
- @url = line.split( /\s+/)[0]
+ @url = line.split(/\s+/)[0]
@host = @url
#
@@ -90,8 +90,8 @@ module Custodian
#
# Get the schema of the URL
#
- u = URI.parse( @url )
- if ( u.scheme != test_type )
+ u = URI.parse(@url)
+ if (u.scheme != test_type)
raise ArgumentError, "The test case has a different protocol in the URI than that which we're testing: #{@line} - \"#{test_type} != #{u.scheme}\""
end
@@ -222,7 +222,7 @@ module Custodian
# running with cache-busting.
#
if @cache_busting
- u = URI.parse( test_url )
+ u = URI.parse(test_url)
if ! u.query
u.query = "ctime=#{Time.now.to_i}"
test_url = u.to_s
@@ -268,7 +268,7 @@ module Custodian
protocol_msg = (resolve_mode == :ipv4 ? 'IPv4' : 'IPv6')
begin
- timeout( period ) do
+ timeout(period) do
c.perform
status = c.response_code
content = c.body_str
diff --git a/lib/custodian/protocoltest/imap.rb b/lib/custodian/protocoltest/imap.rb
index fb80305..3512cd5 100644
--- a/lib/custodian/protocoltest/imap.rb
+++ b/lib/custodian/protocoltest/imap.rb
@@ -22,7 +22,7 @@ module Custodian
#
# Ensure we received a port to run the test against.
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -32,7 +32,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
@@ -76,7 +76,7 @@ module Custodian
# reset the error, in case we were previously executed.
@error = nil
- run_test_internal( @host, @port, /OK/i, true )
+ run_test_internal(@host, @port, /OK/i, true)
end
diff --git a/lib/custodian/protocoltest/jabber.rb b/lib/custodian/protocoltest/jabber.rb
index 916f15f..ba94499 100644
--- a/lib/custodian/protocoltest/jabber.rb
+++ b/lib/custodian/protocoltest/jabber.rb
@@ -22,7 +22,7 @@ module Custodian
#
# Constructor
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -32,7 +32,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
# Is this test inverted?
@@ -74,7 +74,7 @@ module Custodian
# reset the error, in case we were previously executed.
@error = nil
- run_test_internal( @host, @port, nil, false )
+ run_test_internal(@host, @port, nil, false)
end
diff --git a/lib/custodian/protocoltest/ldap.rb b/lib/custodian/protocoltest/ldap.rb
index a5f6605..ed75ae7 100644
--- a/lib/custodian/protocoltest/ldap.rb
+++ b/lib/custodian/protocoltest/ldap.rb
@@ -21,7 +21,7 @@ module Custodian
#
# Constructor
#
- def initialize( line )
+ def initialize(line)
#
# Save the line.
@@ -31,7 +31,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
# The username/password
@@ -101,7 +101,7 @@ module Custodian
begin
# Connect.
- ldap = LDAP::Conn.new( @host, @port )
+ ldap = LDAP::Conn.new(@host, @port)
ldap.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)
# Hardwired search is bad..
@@ -111,7 +111,7 @@ module Custodian
attrs = ['sn', 'cn']
# Bind.
- ldap.bind( @ldap_user, @ldap_pass )
+ ldap.bind(@ldap_user, @ldap_pass)
if ldap.bound?
#
diff --git a/lib/custodian/protocoltest/mx.rb b/lib/custodian/protocoltest/mx.rb
index 61e838c..a9cac62 100644
--- a/lib/custodian/protocoltest/mx.rb
+++ b/lib/custodian/protocoltest/mx.rb
@@ -20,7 +20,7 @@ module Custodian
#
# Constructor
#
- def initialize( line )
+ def initialize(line)
# Save the line away
@line = line
@@ -69,11 +69,11 @@ module Custodian
# Lookup the MX record
#
begin
- timeout( period ) do
+ timeout(period) do
Resolv::DNS.open do |dns|
ress = dns.getresources(@host, Resolv::DNS::Resource::IN::MX)
- ress.map { |r| mx.push( IPSocket.getaddress(r.exchange.to_s) ) }
+ ress.map { |r| mx.push(IPSocket.getaddress(r.exchange.to_s)) }
end
end
rescue Timeout::Error => e
@@ -110,7 +110,7 @@ module Custodian
begin
timeout(period) do
begin
- socket = TCPSocket.new( backend, 25 )
+ socket = TCPSocket.new(backend, 25)
read = socket.sysread(1024)
# trim to a sane length & strip newlines.
diff --git a/lib/custodian/protocoltest/mysql.rb b/lib/custodian/protocoltest/mysql.rb
index 7abc28f..ce63639 100644
--- a/lib/custodian/protocoltest/mysql.rb
+++ b/lib/custodian/protocoltest/mysql.rb
@@ -22,7 +22,7 @@ module Custodian
#
# Ensure we received a port to run the test against.
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -32,7 +32,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
@@ -76,7 +76,7 @@ module Custodian
# reset the error, in case we were previously executed.
@error = nil
- run_test_internal( @host, @port )
+ run_test_internal(@host, @port)
end
diff --git a/lib/custodian/protocoltest/named.rb b/lib/custodian/protocoltest/named.rb
index 4c1b134..321c9d5 100644
--- a/lib/custodian/protocoltest/named.rb
+++ b/lib/custodian/protocoltest/named.rb
@@ -22,7 +22,7 @@ module Custodian
#
# Constructor
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -32,7 +32,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
# Is this test inverted?
@@ -74,7 +74,7 @@ module Custodian
# reset the error, in case we were previously executed.
@error = nil
- run_test_internal( @host, @port, nil, false )
+ run_test_internal(@host, @port, nil, false)
end
diff --git a/lib/custodian/protocoltest/openproxy.rb b/lib/custodian/protocoltest/openproxy.rb
index 04fe833..4beaaca 100644
--- a/lib/custodian/protocoltest/openproxy.rb
+++ b/lib/custodian/protocoltest/openproxy.rb
@@ -29,7 +29,7 @@ module Custodian
#
# Constructor
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -39,7 +39,7 @@ module Custodian
#
# Save the target
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
# Is this test inverted?
@@ -84,7 +84,7 @@ module Custodian
period = settings.timeout
begin
- timeout( period ) do
+ timeout(period) do
begin
c = Curl::Easy.new
c.follow_location = true
@@ -121,7 +121,7 @@ module Custodian
# A this point we've either had an exception, or we've
# got a result.
#
- if ( @status.to_i == 200 )
+ if (@status.to_i == 200)
return true
else
@error = "Proxy fetch of http://google.com/ via #{@host} failed"
diff --git a/lib/custodian/protocoltest/ping.rb b/lib/custodian/protocoltest/ping.rb
index 7d3d802..c2c9a04 100644
--- a/lib/custodian/protocoltest/ping.rb
+++ b/lib/custodian/protocoltest/ping.rb
@@ -26,7 +26,7 @@ module Custodian
#
# Constructor
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -36,7 +36,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
# Is this test inverted?
@@ -71,7 +71,7 @@ module Custodian
#
binary = nil
binary = './bin/multi-ping'
- binary = '/usr/bin/multi-ping' if File.exist?( '/usr/bin/multi-ping' )
+ binary = '/usr/bin/multi-ping' if File.exist?('/usr/bin/multi-ping')
if binary.nil?
@error = "Failed to find '/usr/bin/multi-ping'"
@@ -108,9 +108,9 @@ module Custodian
# Does the name look like an IP?
#
begin
- x = IPAddr.new( @host )
+ x = IPAddr.new(@host)
if x.ipv4? or x.ipv6?
- ips.push( @host )
+ ips.push(@host)
end
rescue ArgumentError
end
@@ -137,16 +137,16 @@ module Custodian
# look it up, as both IPv4 and IPv6.
#
begin
- timeout( period ) do
+ timeout(period) do
Resolv::DNS.open do |dns|
if do_ipv4
ress = dns.getresources(@host, Resolv::DNS::Resource::IN::A)
- ress.map { |r| ips.push( r.address.to_s ) }
+ ress.map { |r| ips.push(r.address.to_s) }
end
if do_ipv6
ress = dns.getresources(@host, Resolv::DNS::Resource::IN::AAAA)
- ress.map { |r| ips.push( r.address.to_s ) }
+ ress.map { |r| ips.push(r.address.to_s) }
end
end
end
@@ -171,7 +171,7 @@ module Custodian
# were given.
#
ips.each do |ip|
- if ( system( binary, ip ) != true )
+ if (system(binary, ip) != true)
@error = "Ping failed for #{ip} - from #{@host} "
return false
end
diff --git a/lib/custodian/protocoltest/pop3.rb b/lib/custodian/protocoltest/pop3.rb
index 3be34b3..eeb1e60 100644
--- a/lib/custodian/protocoltest/pop3.rb
+++ b/lib/custodian/protocoltest/pop3.rb
@@ -22,7 +22,7 @@ module Custodian
#
# Ensure we received a port to run the test against.
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -32,7 +32,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
@@ -76,7 +76,7 @@ module Custodian
# reset the error, in case we were previously executed.
@error = nil
- run_test_internal( @host, @port, /\+OK/i, true )
+ run_test_internal(@host, @port, /\+OK/i, true)
end
diff --git a/lib/custodian/protocoltest/postgresql.rb b/lib/custodian/protocoltest/postgresql.rb
index 2dad5cd..f97776c 100644
--- a/lib/custodian/protocoltest/postgresql.rb
+++ b/lib/custodian/protocoltest/postgresql.rb
@@ -22,7 +22,7 @@ module Custodian
#
# Ensure we received a port to run the test against.
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -32,7 +32,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
@@ -76,7 +76,7 @@ module Custodian
# reset the error, in case we were previously executed.
@error = nil
- run_test_internal( @host, @port )
+ run_test_internal(@host, @port)
end
diff --git a/lib/custodian/protocoltest/redis.rb b/lib/custodian/protocoltest/redis.rb
index d1815aa..1293cc9 100644
--- a/lib/custodian/protocoltest/redis.rb
+++ b/lib/custodian/protocoltest/redis.rb
@@ -22,7 +22,7 @@ module Custodian
#
# Ensure we received a port to run the test against.
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -32,7 +32,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
@@ -76,7 +76,7 @@ module Custodian
# reset the error, in case we were previously executed.
@error = nil
- run_test_internal( @host, @port )
+ run_test_internal(@host, @port)
end
diff --git a/lib/custodian/protocoltest/rsync.rb b/lib/custodian/protocoltest/rsync.rb
index 0f3c288..89f4e65 100644
--- a/lib/custodian/protocoltest/rsync.rb
+++ b/lib/custodian/protocoltest/rsync.rb
@@ -22,7 +22,7 @@ module Custodian
#
# Constructor
#
- def initialize( line )
+ def initialize(line)
#
# Save the line.
@@ -32,7 +32,7 @@ module Custodian
#
# If the target is an URL then strip to the hostname.
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
if @host =~ /^rsync:\/\/([^\/]+)\/?/
@host = $1.dup
end
@@ -78,7 +78,7 @@ module Custodian
# reset the error, in case we were previously executed.
@error = nil
- run_test_internal( @host, @port, /^@RSYNCD/, true )
+ run_test_internal(@host, @port, /^@RSYNCD/, true)
end
diff --git a/lib/custodian/protocoltest/smtp.rb b/lib/custodian/protocoltest/smtp.rb
index 6a8cd65..b27901d 100644
--- a/lib/custodian/protocoltest/smtp.rb
+++ b/lib/custodian/protocoltest/smtp.rb
@@ -22,7 +22,7 @@ module Custodian
#
# Constructor
#
- def initialize( line )
+ def initialize(line)
#
# Save the line.
@@ -32,7 +32,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
# Is this test inverted?
@@ -74,7 +74,7 @@ module Custodian
# reset the error, in case we were previously executed.
@error = nil
- run_test_internal( @host, @port, /^220/, true )
+ run_test_internal(@host, @port, /^220/, true)
end
diff --git a/lib/custodian/protocoltest/smtprelay.rb b/lib/custodian/protocoltest/smtprelay.rb
index ef07f82..0a98a9d 100644
--- a/lib/custodian/protocoltest/smtprelay.rb
+++ b/lib/custodian/protocoltest/smtprelay.rb
@@ -24,9 +24,9 @@ module Custodian
#
# Save away state from the configuration line.
#
- def initialize( line )
+ def initialize(line)
@line = line
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
# Save the port
@@ -63,8 +63,8 @@ module Custodian
def get_hostname
hostname = 'localhost.localdomain'
- if File.exist?( '/etc/hostname' )
- File.readlines('/etc/hostname' ).each do |line|
+ if File.exist?('/etc/hostname')
+ File.readlines('/etc/hostname').each do |line|
hostname = line if !line.nil?
hostname.chomp!
end
@@ -86,7 +86,7 @@ module Custodian
begin
- Net::SMTP.start(@host,@port, get_hostname ) do |smtp|
+ Net::SMTP.start(@host,@port, get_hostname) do |smtp|
sent = smtp.send_message message, 'noreply@bytemark.co.uk', 'noreply@bytemark.co.uk'
@status = sent.status.to_s
diff --git a/lib/custodian/protocoltest/ssh.rb b/lib/custodian/protocoltest/ssh.rb
index 3d5e9fb..324f87d 100644
--- a/lib/custodian/protocoltest/ssh.rb
+++ b/lib/custodian/protocoltest/ssh.rb
@@ -23,7 +23,7 @@ module Custodian
#
# Ensure we received a port to run the test against.
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -33,7 +33,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
@@ -77,7 +77,7 @@ module Custodian
# reset the error, in case we were previously executed.
@error = nil
- run_test_internal( @host, @port, /SSH/i, true )
+ run_test_internal(@host, @port, /SSH/i, true)
end
diff --git a/lib/custodian/protocoltest/ssl.rb b/lib/custodian/protocoltest/ssl.rb
index 39a962d..dc62a77 100644
--- a/lib/custodian/protocoltest/ssl.rb
+++ b/lib/custodian/protocoltest/ssl.rb
@@ -18,7 +18,7 @@ class SSLCheck
attr_reader :errors
# This is a helper for console-debugging.
- def verbose( msg )
+ def verbose(msg)
(msg)
end
@@ -350,7 +350,7 @@ module Custodian
#
# Constructor
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -360,7 +360,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
end
@@ -404,7 +404,7 @@ module Custodian
# If outside 10AM-5PM we don't run the test.
#
if hour < 10 || hour > 17
- puts( "Outside office hours - Not running SSL-Verification of #{@host}" )
+ puts("Outside office hours - Not running SSL-Verification of #{@host}")
return true
end
@@ -412,7 +412,7 @@ module Custodian
# Double-check we've got an SSL host
#
if ! @host =~ /^https:\/\//
- puts( 'Not an SSL URL' )
+ puts('Not an SSL URL')
return true
end
@@ -420,13 +420,13 @@ module Custodian
result = s.verify
if true == result
- puts( "SSL Verification succeeded for #{@host}" )
+ puts("SSL Verification succeeded for #{@host}")
return true
elsif result.nil?
- puts( "SSL Verification returned no result (timeout?) #{@host}" )
+ puts("SSL Verification returned no result (timeout?) #{@host}")
return true
else
- puts( "SSL Verification for #{@host} has failed." )
+ puts("SSL Verification for #{@host} has failed.")
@error = "SSL Verification for #{@host} failed: "
@error += s.errors.join("\n")
return false
diff --git a/lib/custodian/protocoltest/tcp.rb b/lib/custodian/protocoltest/tcp.rb
index ca622bb..0f7e2b5 100644
--- a/lib/custodian/protocoltest/tcp.rb
+++ b/lib/custodian/protocoltest/tcp.rb
@@ -60,7 +60,7 @@ module Custodian
#
# Ensure we received a port to run the TCP-test against.
#
- def initialize( line )
+ def initialize(line)
#
# Save the line
@@ -70,7 +70,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
# Is this test inverted?
@@ -126,7 +126,7 @@ module Custodian
# reset the error, in case we were previously executed.
@error = nil
- ( run_test_internal( @host, @port, @banner, ( ! @banner.nil? ) ) )
+ (run_test_internal(@host, @port, @banner, (! @banner.nil?)))
end
@@ -148,7 +148,7 @@ module Custodian
#
# A failure in either version will result in a failure.
#
- def run_test_internal( host, port, banner = nil, do_read = false )
+ def run_test_internal(host, port, banner = nil, do_read = false)
#
# Get the timeout period.
@@ -165,9 +165,9 @@ module Custodian
# Does the name look like an IP?
#
begin
- x = IPAddr.new( host )
+ x = IPAddr.new(host)
if x.ipv4? or x.ipv6?
- ips.push( host )
+ ips.push(host)
end
rescue ArgumentError
#
@@ -197,17 +197,17 @@ module Custodian
# look it up, as both IPv4 and IPv6.
#
begin
- timeout( period ) do
+ timeout(period) do
Resolv::DNS.open do |dns|
if do_ipv4
ress = dns.getresources(host, Resolv::DNS::Resource::IN::A)
- ress.map { |r| ips.push( r.address.to_s ) }
+ ress.map { |r| ips.push(r.address.to_s) }
end
if do_ipv6
ress = dns.getresources(host, Resolv::DNS::Resource::IN::AAAA)
- ress.map { |r| ips.push( r.address.to_s ) }
+ ress.map { |r| ips.push(r.address.to_s) }
end
end
end
@@ -232,7 +232,7 @@ module Custodian
# were given.
#
ips.each do |ip|
- if ! run_test_internal_real( ip, port, banner, do_read )
+ if ! run_test_internal_real(ip, port, banner, do_read)
return false
#
@@ -260,7 +260,7 @@ module Custodian
# This method will ONLY ever be invoked with an IP-address for a
# destination.
#
- def run_test_internal_real( host, port, banner = nil, do_read = false )
+ def run_test_internal_real(host, port, banner = nil, do_read = false)
#
# Get the timeout period for this test.
@@ -271,7 +271,7 @@ module Custodian
begin
timeout(period) do
begin
- socket = TCPSocket.new( host, port )
+ socket = TCPSocket.new(host, port)
# read a banner from the remote server, if we're supposed to.
read = nil
@@ -293,14 +293,14 @@ module Custodian
# regexp.
if banner.kind_of? Regexp
- if ( !read.nil? ) && ( banner.match(read) )
+ if (!read.nil?) && (banner.match(read))
return true
end
end
# string.
if banner.kind_of? String
- if ( !read.nil? ) && ( read =~ /#{banner}/i )
+ if (!read.nil?) && (read =~ /#{banner}/i)
return true
end
end
diff --git a/lib/custodian/protocoltest/telnet.rb b/lib/custodian/protocoltest/telnet.rb
index f485191..a73b35c 100644
--- a/lib/custodian/protocoltest/telnet.rb
+++ b/lib/custodian/protocoltest/telnet.rb
@@ -22,7 +22,7 @@ module Custodian
#
# Constructor
#
- def initialize( line )
+ def initialize(line)
#
# Save the line.
@@ -32,7 +32,7 @@ module Custodian
#
# Save the host
#
- @host = line.split( /\s+/)[0]
+ @host = line.split(/\s+/)[0]
#
# Is this test inverted?
@@ -74,7 +74,7 @@ module Custodian
# reset the error, in case we were previously executed.
@error = nil
- run_test_internal( @host, @port, nil, false )
+ run_test_internal(@host, @port, nil, false)
end