Handle management IP of one device being in use on another device
This commit is contained in:
		| @@ -15,6 +15,7 @@ | ||||
|   * Show netdisco-do docs on options error | ||||
|   * Do not leak SNMP community string into debug output (unless SHOW_COMMUNITY=1) | ||||
|   * Process tree updated to show daemon worker status/activity | ||||
|   * Handle management IP of one device being in use on another device | ||||
|  | ||||
|   [BUG FIXES] | ||||
|  | ||||
|   | ||||
| @@ -49,8 +49,12 @@ sub get_device { | ||||
|   # naive check for existing DBIC object | ||||
|   return $ip if ref $ip; | ||||
|  | ||||
|   my $alias = schema('netdisco')->resultset('DeviceIp') | ||||
|     ->search({alias => $ip})->first; | ||||
|   # in case the management IP of one device is in use on another device, | ||||
|   # we first try to get an exact match for the IP as mgmt interface. | ||||
|   my $alias = | ||||
|     schema('netdisco')->resultset('DeviceIp')->find($ip, $ip) | ||||
|     || | ||||
|     schema('netdisco')->resultset('DeviceIp')->search({alias => $ip})->first; | ||||
|   $ip = $alias->ip if defined $alias; | ||||
|  | ||||
|   return schema('netdisco')->resultset('Device')->with_times | ||||
|   | ||||
| @@ -14,7 +14,7 @@ register_search_tab( | ||||
| # device with various properties or a default match-all | ||||
| get '/ajax/content/search/device' => require_login sub { | ||||
|     my $has_opt = List::MoreUtils::any { param($_) } | ||||
|     qw/name location dns ip description model os_ver vendor layers/; | ||||
|       qw/name location dns ip description model os_ver vendor layers/; | ||||
|     my $rs; | ||||
|  | ||||
|     if ($has_opt) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user