diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-03-09 13:19:47 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-03-09 13:19:47 +0000 |
commit | 54b21cf54c51dfe40784a8096f84c7a80b015bd4 (patch) | |
tree | 4763692624732650daf1a9e02c91576d3f7ee8d0 /lib/custodian/protocoltest/dns.rb | |
parent | a22b8e96ead33b0f97ed5243dbad7f7b6cd5135d (diff) |
Removed spaces inside parenthesis.
Diffstat (limited to 'lib/custodian/protocoltest/dns.rb')
-rw-r--r-- | lib/custodian/protocoltest/dns.rb | 26 |
1 files changed, 13 insertions, 13 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}'" |