From 5d335919037ca36683d67ac755a493fcd63ac66c Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 2 Mar 2013 15:56:13 +0000 Subject: [PATCH] Search by device port MAC no longer fatal --- Netdisco/Changes | 4 ++++ Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Netdisco/Changes b/Netdisco/Changes index 0d6a785b..56204e7b 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -12,6 +12,10 @@ * Use Path::Class for path and file name construction consistently * Avoid use of DNS when looking up devices in DB by IP + [BIG FIXES] + + * Search by device port MAC no longer fatal + 2.005000_002 - 2013-02-10 [ENHANCEMENTS] diff --git a/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm b/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm index 8841f172..f5e6f0f8 100644 --- a/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm +++ b/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm @@ -70,7 +70,8 @@ sub search_aliases { my $clause; if ($by_ip) { - my $ip = NetAddr::IP::Lite->new($q); + my $ip = NetAddr::IP::Lite->new($q) + or return undef; # could be a MAC address! $clause = [ 'me.ip' => { '<<=' => $ip->cidr }, 'device_ips.alias' => { '<<=' => $ip->cidr },