mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
cleanup device type override code (#13256)
This commit is contained in:
@@ -994,11 +994,11 @@ function load_os(&$device)
|
||||
|
||||
// Set type to a predefined type for the OS if it's not already set
|
||||
$loaded_os_type = Config::get("os.{$device['os']}.type");
|
||||
if ((! isset($device['attribs']['override_device_type']) && $device['attribs']['override_device_type'] != 1) && array_key_exists('type', $device) && $loaded_os_type != $device['type']) {
|
||||
log_event('Device type changed ' . $device['type'] . ' => ' . $loaded_os_type, $device, 'system', 3);
|
||||
$device['type'] = $loaded_os_type;
|
||||
dbUpdate(['type' => $loaded_os_type], 'devices', 'device_id=?', [$device['device_id']]);
|
||||
d_echo("Device type changed to $loaded_os_type!\n");
|
||||
$model = DeviceCache::get($device['device_id']);
|
||||
if (! $model->getAttrib('override_device_type') && $loaded_os_type != $model->type) {
|
||||
$model->type = $loaded_os_type;
|
||||
$model->save();
|
||||
Log::debug("Device type changed to $loaded_os_type!");
|
||||
}
|
||||
|
||||
if ($os_group = Config::get("os.{$device['os']}.group")) {
|
||||
|
Reference in New Issue
Block a user