[icinga-checkins] icinga.org: icingaweb2/bugfix/ icingacli-shows-exception-when-unable-to-access-the-config-directory-11119 : Present the fact that Icinga Web 2's config directory isn' t readable in a nicer way

git at icinga.org git at icinga.org
Thu Feb 25 16:24:20 CET 2016


Module: icingaweb2
Branch: bugfix/icingacli-shows-exception-when-unable-to-access-the-config-directory-11119
Commit: 1260ab7d5a9aafb99aead555400b6b4a2f3d1436
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=1260ab7d5a9aafb99aead555400b6b4a2f3d1436

Author: Alexander A. Klimov <alexander.klimov at netways.de>
Date:   Thu Feb 25 16:22:50 2016 +0100

Present the fact that Icinga Web 2's config directory isn't readable in a nicer way

refs #11119

---

 library/Icinga/Application/Cli.php |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/library/Icinga/Application/Cli.php b/library/Icinga/Application/Cli.php
index 4fa8bf0..d11a951 100644
--- a/library/Icinga/Application/Cli.php
+++ b/library/Icinga/Application/Cli.php
@@ -11,6 +11,7 @@ use Icinga\Cli\Screen;
 use Icinga\Application\Logger;
 use Icinga\Application\Benchmark;
 use Icinga\Data\ConfigObject;
+use Icinga\Exception\NotReadableError;
 use Icinga\Exception\ProgrammingError;
 
 require_once __DIR__ . '/ApplicationBootstrap.php';
@@ -136,10 +137,14 @@ class Cli extends ApplicationBootstrap
     {
         Benchmark::measure('Dispatching CLI command');
 
-        if ($this->watchTimeout === null) {
-            $this->dispatchOnce();
-        } else {
-            $this->dispatchEndless();
+        try {
+            if ($this->watchTimeout === null) {
+                $this->dispatchOnce();
+            } else {
+                $this->dispatchEndless();
+            }
+        } catch (NotReadableError $e) {
+            $this->cliLoader()->fail($e->getMessage());
         }
 
     }



More information about the icinga-checkins mailing list