Push a row into Device Modules for the chassis even if no module info
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
* Log at debug the vlan reindexing in macsuck
|
* Log at debug the vlan reindexing in macsuck
|
||||||
* Add docs note about database backups
|
* Add docs note about database backups
|
||||||
* Always set DBIC_TRACE_PROFILE=console in environment
|
* Always set DBIC_TRACE_PROFILE=console in environment
|
||||||
|
* Push a row into Device Modules for the chassis even if no module info
|
||||||
|
|
||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|
||||||
|
|||||||
@@ -578,10 +578,35 @@ not yet stored to the database.
|
|||||||
sub store_modules {
|
sub store_modules {
|
||||||
my ($device, $snmp) = @_;
|
my ($device, $snmp) = @_;
|
||||||
|
|
||||||
my $e_index = $snmp->e_index;
|
my $e_index = $snmp->e_index;
|
||||||
|
|
||||||
if (!defined $e_index) {
|
if (!defined $e_index) {
|
||||||
debug sprintf ' [%s] modules - 0 chassis components', $device->ip;
|
schema('netdisco')->txn_do(sub {
|
||||||
|
my $gone = $device->modules->delete;
|
||||||
|
debug sprintf ' [%s] modules - removed %d chassis modules',
|
||||||
|
$device->ip, $gone;
|
||||||
|
|
||||||
|
$device->modules->update_or_create({
|
||||||
|
ip => $device->ip,
|
||||||
|
index => 1,
|
||||||
|
parent => 0,
|
||||||
|
name => 'chassis',
|
||||||
|
class => 'chassis',
|
||||||
|
pos => -1,
|
||||||
|
# too verbose and link doesn't work anyway
|
||||||
|
# description => $device->description,
|
||||||
|
sw_ver => $device->os_ver,
|
||||||
|
serial => $device->serial,
|
||||||
|
model => $device->model,
|
||||||
|
fru => \'false',
|
||||||
|
last_discover => \'now()',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
debug
|
||||||
|
sprintf ' [%s] modules - 0 chassis components (added one pseudo for chassis)',
|
||||||
|
$device->ip;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user