summaryrefslogtreecommitdiff
path: root/lib/custodian/protocoltest/ping.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-03-09 13:10:32 +0000
committerSteve Kemp <steve@steve.org.uk>2015-03-09 13:10:32 +0000
commitfea454753efc4a673751131960c394254555d34a (patch)
tree47732a1c331c236f8f082dc4f6f5a6c6d6dab058 /lib/custodian/protocoltest/ping.rb
parentedf0e675123e4869e2739d1bab0ed57b3b9f664c (diff)
Don't use parenthesis aroudn conditions in an if.
Diffstat (limited to 'lib/custodian/protocoltest/ping.rb')
-rw-r--r--lib/custodian/protocoltest/ping.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/custodian/protocoltest/ping.rb b/lib/custodian/protocoltest/ping.rb
index 423b925..90e4241 100644
--- a/lib/custodian/protocoltest/ping.rb
+++ b/lib/custodian/protocoltest/ping.rb
@@ -41,7 +41,7 @@ module Custodian
#
# Is this test inverted?
#
- if ( line =~ /must\s+not\s+run\s+/ )
+ if line =~ /must\s+not\s+run\s+/
@inverted = true
else
@inverted = false
@@ -71,9 +71,9 @@ 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? )
+ if binary.nil?
@error = "Failed to find '/usr/bin/multi-ping'"
return false
end
@@ -85,7 +85,7 @@ module Custodian
#
# $(/tmp/exploit.sh) must run ping ..
#
- if ( @host !~ /^([a-zA-Z0-9:\-\.]+)$/ )
+ if @host !~ /^([a-zA-Z0-9:\-\.]+)$/
@error = "Invalid hostname for ping-test: #{@host}"
return false
end
@@ -109,7 +109,7 @@ module Custodian
#
begin
x = IPAddr.new( @host )
- if ( x.ipv4? or x.ipv6? )
+ if x.ipv4? or x.ipv6?
ips.push( @host )
end
rescue ArgumentError
@@ -125,10 +125,10 @@ module Custodian
#
# Allow the test to disable one/both
#
- if ( @line =~ /ipv4_only/ )
+ if @line =~ /ipv4_only/
do_ipv6 = false
end
- if ( @line =~ /ipv6_only/ )
+ if @line =~ /ipv6_only/
do_ipv4 = false
end
@@ -140,11 +140,11 @@ module Custodian
timeout( period ) do
Resolv::DNS.open do |dns|
- if ( do_ipv4 )
+ if do_ipv4
ress = dns.getresources(@host, Resolv::DNS::Resource::IN::A)
ress.map { |r| ips.push( r.address.to_s ) }
end
- if ( do_ipv6 )
+ if do_ipv6
ress = dns.getresources(@host, Resolv::DNS::Resource::IN::AAAA)
ress.map { |r| ips.push( r.address.to_s ) }
end
@@ -159,7 +159,7 @@ module Custodian
#
# Did we fail to perform a DNS lookup?
#
- if ( ips.empty? )
+ if ips.empty?
@error = "#{@host} failed to resolve to either IPv4 or IPv6"
return false
end