Fix previous commit

* revert unwanted commit of bogus Web/Plugin/Device/Modules.pm
 * commit actual fix for #710
This commit is contained in:
Christian Ramseyer
2020-04-25 17:32:01 +02:00
parent 5663f84917
commit dcb45e4cad
2 changed files with 12 additions and 13 deletions

View File

@@ -91,6 +91,18 @@ register_worker({ phase => 'main', driver => 'snmp' }, sub {
};
}
foreach my $m (@modules){
unless ($seen_idx{$m->{parent}} || !$m->{parent}){
# Some combined devices like Nexus with FEX or ASR with Satellites can return invalid
# EntityMIB trees. This workaround relocates entitites with invalid parents to the root
# of the tree, so they are at least visible in the Modules tab (see #710)
info sprintf ' [%s] Entity %s (%s) has invalid parent %s - attaching as root entity instead',
$device->ip, $m->{index}, $m->{name}, $m->{parent};
$m->{parent} = undef;
}
}
schema('netdisco')->txn_do(sub {
my $gone = $device->modules->delete;
debug sprintf ' [%s] modules - removed %d chassis modules',