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 | e716a49dabe2c086a97e2d8b3cffe5cf369ad026 (patch) | |
tree | e7e98125f89941db4c9d0f48f2df9c410467a3d8 /lib/custodian/protocoltest/dns.rb | |
parent | af2ee063abea8235a8cbd1448533e4f4fbc0d0af (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}'" |