Fix empty module folder causing errors, fix var naming
Fix a wrongly named class causing ClassNotFound issues, also added additional checks for empty module folder and added en moduleFolder directive to configure module location refs #4092
This commit is contained in:
parent
35c43446d8
commit
677593cf8c
|
@ -3,6 +3,7 @@ environment = development
|
||||||
timezone = "Europe/Berlin"
|
timezone = "Europe/Berlin"
|
||||||
indexModule = monitoring
|
indexModule = monitoring
|
||||||
indexController = dashboard
|
indexController = dashboard
|
||||||
|
moduleFolder = "/usr/etc/icinga-modules"
|
||||||
|
|
||||||
[logging]
|
[logging]
|
||||||
; General log
|
; General log
|
||||||
|
|
|
@ -100,7 +100,7 @@ abstract class ApplicationBootstrap
|
||||||
public function moduleManager()
|
public function moduleManager()
|
||||||
{
|
{
|
||||||
if ($this->moduleManager === null) {
|
if ($this->moduleManager === null) {
|
||||||
$this->moduleManager = new ModuleManager($this, "/etc/icinga2/modules_enabled");
|
$this->moduleManager = new ModuleManager($this, $this->config->global->moduleFolder);
|
||||||
}
|
}
|
||||||
return $this->moduleManager;
|
return $this->moduleManager;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Manager
|
||||||
|
|
||||||
public function select()
|
public function select()
|
||||||
{
|
{
|
||||||
$source = new \Icinga\Data\ArrayDataSource($this->getModuleInfo());
|
$source = new \Icinga\Data\ArrayDatasource($this->getModuleInfo());
|
||||||
return $source->select();
|
return $source->select();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +238,12 @@ class Manager
|
||||||
public function getModuleInfo()
|
public function getModuleInfo()
|
||||||
{
|
{
|
||||||
$installed = $this->listInstalledModules();
|
$installed = $this->listInstalledModules();
|
||||||
|
|
||||||
$info = array();
|
$info = array();
|
||||||
|
if ($installed === null) {
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($installed as $name) {
|
foreach ($installed as $name) {
|
||||||
$info[] = (object) array(
|
$info[] = (object) array(
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
|
@ -265,7 +270,10 @@ class Manager
|
||||||
if ($this->installedBaseDirs === null) {
|
if ($this->installedBaseDirs === null) {
|
||||||
$this->detectInstalledModules();
|
$this->detectInstalledModules();
|
||||||
}
|
}
|
||||||
return array_keys($this->installedBaseDirs);
|
|
||||||
|
if ($this->installedBaseDirs !== null) {
|
||||||
|
return array_keys($this->installedBaseDirs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function detectInstalledModules()
|
public function detectInstalledModules()
|
||||||
|
|
|
@ -108,6 +108,5 @@
|
||||||
containerMgrInstance = new ContainerMgr($,log,widgets,subTable);
|
containerMgrInstance = new ContainerMgr($,log,widgets,subTable);
|
||||||
}
|
}
|
||||||
return containerMgrInstance;
|
return containerMgrInstance;
|
||||||
|
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -80,5 +80,3 @@ define([
|
||||||
};
|
};
|
||||||
return new Icinga();
|
return new Icinga();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,4 +24,3 @@ define(['jquery','Holder'], function ($) {
|
||||||
window.Icinga = Icinga;
|
window.Icinga = Icinga;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue