mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* fix: Detection blank or unknown device types and update #5412 * Less ifs
This commit is contained in:
committed by
Tony Murray
parent
7215059fd0
commit
6ff3ae8789
@@ -1527,10 +1527,11 @@ function load_os(&$device)
|
||||
);
|
||||
|
||||
// Set type to a predefined type for the OS if it's not already set
|
||||
if ($device['type'] == 'unknown' || $device['type'] == '') {
|
||||
if ($config['os'][$device['os']]['type']) {
|
||||
$device['type'] = $config['os'][$device['os']]['type'];
|
||||
}
|
||||
if ($config['os'][$device['os']]['type'] != $device['type']) {
|
||||
log_event('Device type changed '.$device['type'].' => '.$config['os'][$device['os']]['type'], $device, 'system');
|
||||
$device['type'] = $config['os'][$device['os']]['type'];
|
||||
dbUpdate(array('type' => $device['type']), 'devices', 'device_id=?', array($device['device_id']));
|
||||
echo "Device type changed to " . $device['type'] . "!\n";
|
||||
}
|
||||
|
||||
if ($config['os'][$device['os']]['group']) {
|
||||
|
@@ -15,10 +15,3 @@ if ($icon != $device['icon']) {
|
||||
$sql = dbUpdate(array('icon' => $icon), 'devices', 'device_id=?', array($device['device_id']));
|
||||
echo "Changed Icon! : $icon\n";
|
||||
}
|
||||
|
||||
if ($config['os'][$device['os']]['type'] != $device['type']) {
|
||||
log_event('Device type changed '.$device['type'].' => '.$config['os'][$device['os']]['type'], $device, 'system');
|
||||
$device['type'] = $config['os'][$device['os']]['type'];
|
||||
$sql = dbUpdate(array('type' => $device['type']), 'devices', 'device_id=?', array($device['device_id']));
|
||||
echo "Changed Type! : ".$device['type'].PHP_EOL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user