mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fully convert core to a modern module (#13347)
* Core module WIP * update OS::make() * core WIP * try to finish up * switch all core do os Model * Mock WIP * Working tests * cleanup * phpstan fixes * style fixes * fix agent * trim space too and a couple of cleanups * corrected ios test data * missed space * update test data * put escapes back * another net-snmp difference * Fix class description * revert snmp.inc.php change, that can be a different PR * revert snmp.inc.php change, that can be a different PR
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* OS.php
|
||||
*
|
||||
* Base OS class
|
||||
* -Description-
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -19,7 +19,7 @@
|
||||
*
|
||||
* @link https://www.librenms.org
|
||||
*
|
||||
* @copyright 2017 Tony Murray
|
||||
* @copyright 2021 Tony Murray
|
||||
* @author Tony Murray <murraytony@gmail.com>
|
||||
*/
|
||||
|
||||
@@ -39,6 +39,7 @@ use LibreNMS\OS\Traits\HostResources;
|
||||
use LibreNMS\OS\Traits\UcdResources;
|
||||
use LibreNMS\OS\Traits\YamlMempoolsDiscovery;
|
||||
use LibreNMS\OS\Traits\YamlOSDiscovery;
|
||||
use LibreNMS\Util\StringHelpers;
|
||||
|
||||
class OS implements ProcessorDiscovery, OSDiscovery, MempoolsDiscovery
|
||||
{
|
||||
@@ -212,7 +213,7 @@ class OS implements ProcessorDiscovery, OSDiscovery, MempoolsDiscovery
|
||||
unset($device['os_group']);
|
||||
}
|
||||
|
||||
$class = str_to_class($device['os'], 'LibreNMS\\OS\\');
|
||||
$class = StringHelpers::toClass($device['os'], 'LibreNMS\\OS\\');
|
||||
d_echo('Attempting to initialize OS: ' . $device['os'] . PHP_EOL);
|
||||
if (class_exists($class)) {
|
||||
d_echo("OS initialized: $class\n");
|
||||
@@ -221,9 +222,9 @@ class OS implements ProcessorDiscovery, OSDiscovery, MempoolsDiscovery
|
||||
}
|
||||
|
||||
// If not a specific OS, check for a group one.
|
||||
if ($os_group) {
|
||||
$class = str_to_class($device['os_group'], 'LibreNMS\\OS\\Shared\\');
|
||||
d_echo('Attempting to initialize OS: ' . $device['os_group'] . PHP_EOL);
|
||||
if ($os_group = Config::get("os.{$device['os']}.group")) {
|
||||
$class = StringHelpers::toClass($os_group, 'LibreNMS\\OS\\Shared\\');
|
||||
d_echo("Attempting to initialize Group OS: $os_group\n");
|
||||
if (class_exists($class)) {
|
||||
d_echo("OS initialized: $class\n");
|
||||
|
||||
|
Reference in New Issue
Block a user