#317 when renumbering on discover, delete likely duplicate devices
This commit is contained in:
1
Changes
1
Changes
@@ -8,6 +8,7 @@
|
||||
|
||||
* #320 DNS subroutines are redefined
|
||||
* #318 ACLs with RegExp are very slow - aggressive resolver timeouts
|
||||
* #317 when renumbering on discover, delete likely duplicate devices
|
||||
|
||||
2.036001 - 2017-06-22
|
||||
|
||||
|
||||
@@ -98,6 +98,12 @@ sub set_canonical_ip {
|
||||
return if $new_ip eq $old_ip;
|
||||
|
||||
schema('netdisco')->txn_do(sub {
|
||||
# delete target device with the same vendor and serial number
|
||||
schema('netdisco')->resultset('Device')->search({
|
||||
ip => $new_ip, vendor => $device->vendor, serial => $device->serial,
|
||||
})->delete;
|
||||
|
||||
# if target device exists then this will die
|
||||
$device->renumber($new_ip)
|
||||
or die "cannot renumber to: $new_ip"; # rollback
|
||||
|
||||
|
||||
Reference in New Issue
Block a user