keep port custom_fields in place across device discovery
This commit is contained in:
@@ -371,6 +371,12 @@ register_worker({ phase => 'early', driver => 'snmp' }, sub {
|
||||
vars->{'hook_data'}->{'ports'} = [values %deviceports];
|
||||
|
||||
schema('netdisco')->resultset('DevicePort')->txn_do_locked(sub {
|
||||
# backup the custom_fields
|
||||
my @fields = grep {exists $deviceports{$_->{port}}} $device->ports
|
||||
->search(undef, {columns => [qw/port custom_fields/]})->hri->all;
|
||||
$deviceports{$_->{port}}->{custom_fields} = $_->{custom_fields}
|
||||
for @fields;
|
||||
|
||||
my $gone = $device->ports->delete({keep_nodes => 1});
|
||||
debug sprintf ' [%s] interfaces - removed %d interfaces',
|
||||
$device->ip, $gone;
|
||||
|
||||
Reference in New Issue
Block a user