Load resources from config automatically instead of throwing an exception

fixes #10918
This commit is contained in:
Eric Lippmann 2016-02-26 12:29:30 +01:00
parent 9d5e21e71e
commit e4a0678df0
4 changed files with 2 additions and 25 deletions

View File

@ -520,25 +520,6 @@ abstract class ApplicationBootstrap
return $this;
}
/**
* Set up the resource factory
*
* @return $this
*/
protected function setupResourceFactory()
{
try {
$config = Config::app('resources');
ResourceFactory::setConfig($config);
} catch (NotReadableError $e) {
Logger::error(
new IcingaException('Cannot load resource configuration. An exception was thrown:', $e)
);
}
return $this;
}
/**
* Set up the user backend factory
*

View File

@ -41,7 +41,6 @@ class Cli extends ApplicationBootstrap
->setupInternationalization()
->parseBasicParams()
->setupLogger()
->setupResourceFactory()
->setupModuleManager()
->setupUserBackendFactory()
->loadSetupModuleIfNecessary();

View File

@ -82,7 +82,6 @@ class Web extends EmbeddedWeb
->setupLogging()
->setupErrorHandling()
->loadConfig()
->setupResourceFactory()
->setupSession()
->setupNotifications()
->setupRequest()

View File

@ -67,16 +67,14 @@ class ResourceFactory implements ConfigAwareFactory
}
/**
* Check if the existing resources are set. If not, throw an error.
* Check if the existing resources are set. If not, load them from resources.ini
*
* @throws ConfigurationError
*/
private static function assertResourcesExist()
{
if (self::$resources === null) {
throw new ConfigurationError(
'Resources not set up. Please contact your Icinga Web administrator'
);
self::$resources = Config::app('resources');
}
}