From e4a0678df01ee26eb5969316bdc04e765f99e582 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 26 Feb 2016 12:29:30 +0100 Subject: [PATCH] Load resources from config automatically instead of throwing an exception fixes #10918 --- .../Application/ApplicationBootstrap.php | 19 ------------------- library/Icinga/Application/Cli.php | 1 - library/Icinga/Application/Web.php | 1 - library/Icinga/Data/ResourceFactory.php | 6 ++---- 4 files changed, 2 insertions(+), 25 deletions(-) diff --git a/library/Icinga/Application/ApplicationBootstrap.php b/library/Icinga/Application/ApplicationBootstrap.php index c14f58884..7f0a51b25 100644 --- a/library/Icinga/Application/ApplicationBootstrap.php +++ b/library/Icinga/Application/ApplicationBootstrap.php @@ -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 * diff --git a/library/Icinga/Application/Cli.php b/library/Icinga/Application/Cli.php index 4fa8bf01e..1ef90e2cb 100644 --- a/library/Icinga/Application/Cli.php +++ b/library/Icinga/Application/Cli.php @@ -41,7 +41,6 @@ class Cli extends ApplicationBootstrap ->setupInternationalization() ->parseBasicParams() ->setupLogger() - ->setupResourceFactory() ->setupModuleManager() ->setupUserBackendFactory() ->loadSetupModuleIfNecessary(); diff --git a/library/Icinga/Application/Web.php b/library/Icinga/Application/Web.php index 7104080ae..02f0aa9a5 100644 --- a/library/Icinga/Application/Web.php +++ b/library/Icinga/Application/Web.php @@ -82,7 +82,6 @@ class Web extends EmbeddedWeb ->setupLogging() ->setupErrorHandling() ->loadConfig() - ->setupResourceFactory() ->setupSession() ->setupNotifications() ->setupRequest() diff --git a/library/Icinga/Data/ResourceFactory.php b/library/Icinga/Data/ResourceFactory.php index 46c114660..cf424963e 100644 --- a/library/Icinga/Data/ResourceFactory.php +++ b/library/Icinga/Data/ResourceFactory.php @@ -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'); } }