Push a row into Device Modules for the chassis even if no module info

This commit is contained in:
Oliver Gorwits
2014-08-08 22:26:44 +01:00
parent 1f73f061f7
commit 1c3e0f260c
2 changed files with 28 additions and 2 deletions

View File

@@ -19,6 +19,7 @@
* Log at debug the vlan reindexing in macsuck
* Add docs note about database backups
* Always set DBIC_TRACE_PROFILE=console in environment
* Push a row into Device Modules for the chassis even if no module info
[BUG FIXES]

View File

@@ -578,10 +578,35 @@ not yet stored to the database.
sub store_modules {
my ($device, $snmp) = @_;
my $e_index = $snmp->e_index;
my $e_index = $snmp->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;
}