From 715ae9c45b11a2f1a2c62c3d69ae5d76e73d3865 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Fri, 16 Nov 2012 16:07:14 +0000 Subject: Remove redundent text in alerts if the target was an IP --- lib/custodian/alerter.rb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'lib/custodian') diff --git a/lib/custodian/alerter.rb b/lib/custodian/alerter.rb index da3571e..f78d299 100644 --- a/lib/custodian/alerter.rb +++ b/lib/custodian/alerter.rb @@ -83,10 +83,24 @@ class Alerter # # Test trange, and format the appropriate message. # + inside = false; if ( BYTEMARK_RANGES.any?{|range| range.include?(IPAddr.new(resolved.to_s))} ) - return "

#{host} resolves to #{resolved} which is inside the Bytemark network.

" + inside = true + end + + + if ( inside ) + if ( resolved == target ) + return "

#{host} is inside the Bytemark network.

" + else + return "

#{host} resolves to #{resolved} which is inside the Bytemark network.

" + end else - return "

#{host} resolves to #{resolved} which is not inside the Bytemark network.

" + if ( resolved == target ) + return "

#{host} is OUTSIDE the Bytemark network.

" + else + return "

#{host} resolves to #{resolved} which is OUTSIDE the Bytemark network.

" + end end end -- cgit v1.2.1