diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-03-09 13:10:32 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-03-09 13:10:32 +0000 |
commit | 1ce0906b3480702085d4596dbb4758c115ab298f (patch) | |
tree | 695cd365c2ff73904328a049f3b9cfcc5a0a1abd /lib/custodian/protocoltest/ping.rb | |
parent | 891b720013f06f092f6be82adad95e5551c696b6 (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.rb | 20 |
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 |