[icinga-checkins] icinga.org: icingaweb2-module-director/master: InspectController: delegate api instantiation

git at icinga.org git at icinga.org
Wed Feb 17 16:44:59 CET 2016


Module: icingaweb2-module-director
Branch: master
Commit: bf31f77961930823a41f744d8dcc31257ab8b998
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=bf31f77961930823a41f744d8dcc31257ab8b998

Author: Thomas Gelf <thomas at gelf.net>
Date:   Wed Feb 17 16:40:43 2016 +0100

InspectController: delegate api instantiation

---

 application/controllers/InspectController.php |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/application/controllers/InspectController.php b/application/controllers/InspectController.php
index 2814af1..9e2ea6f 100644
--- a/application/controllers/InspectController.php
+++ b/application/controllers/InspectController.php
@@ -2,9 +2,6 @@
 
 namespace Icinga\Module\Director\Controllers;
 
-use Icinga\Module\Director\Core\CoreApi;
-use Icinga\Module\Director\Core\RestApiClient;
-use Icinga\Module\Director\Objects\IcingaEndpoint;
 use Icinga\Module\Director\Web\Controller\ActionController;
 
 class InspectController extends ActionController
@@ -95,18 +92,13 @@ class InspectController extends ActionController
         print_r($status); exit;
     }
 
-    protected function api()
+    protected function api($endpointName = null)
     {
         $this->view->endpoint = $this->params->get('endpoint');
         if ($this->view->endpoint === null) {
             $this->view->endpoint = $this->db()->getDeploymentEndpointName();
         }
 
-        $endpoint = IcingaEndpoint::load($this->view->endpoint, $this->db());
-        $apiconfig = $this->Config()->getSection('api');
-        $client = new RestApiClient($endpoint->host, $endpoint->port);
-        $client->setCredentials($apiconfig->get('username'), $apiconfig->get('password'));
-        $api = new CoreApi($client);
-        return $api;
+        return parent::api($this->view->endpoint);
     }
 }



More information about the icinga-checkins mailing list