mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
+3
-10
@@ -192,20 +192,13 @@ class Device extends BaseModel
|
||||
|
||||
public function loadOs($force = false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$yaml_file = base_path('/includes/definitions/' . $this->os . '.yaml');
|
||||
|
||||
if ((empty($config['os'][$this->os]['definition_loaded']) || $force) && file_exists($yaml_file)) {
|
||||
if ((!\LibreNMS\Config::getOsSetting($this->os, 'definition_loaded') || $force) && file_exists($yaml_file)) {
|
||||
$os = \Symfony\Component\Yaml\Yaml::parse(file_get_contents($yaml_file));
|
||||
|
||||
if (isset($config['os'][$this->os])) {
|
||||
$config['os'][$this->os] = array_replace_recursive($os, $config['os'][$this->os]);
|
||||
} else {
|
||||
$config['os'][$this->os] = $os;
|
||||
}
|
||||
|
||||
$config['os'][$this->os]['definition_loaded'] = true;
|
||||
\LibreNMS\Config::set("os.$this->os", array_replace_recursive($os, \LibreNMS\Config::get("os.$this->os", [])));
|
||||
\LibreNMS\Config::set("os.$this->os.definition_loaded", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user