[icinga-checkins] icinga.org: icingaweb2-module-director/master: Db: getDeploymentEndpointName should retrieve...

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


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

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

Db: getDeploymentEndpointName should retrieve...

...only endpoints with a configured api user

---

 library/Director/Db.php |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/library/Director/Db.php b/library/Director/Db.php
index b659975..90627da 100644
--- a/library/Director/Db.php
+++ b/library/Director/Db.php
@@ -38,12 +38,16 @@ class Db extends DbConnection
     {
         $db = $this->db();
         $query = $db->select()->from(
-            array('e' => 'icinga_endpoint'),
+            array('z' => 'icinga_zone'),
             array('object_name' => 'e.object_name')
         )->join(
-            array('z' => 'icinga_zone'),
-            array(),
-            'e.zone_id = z.id'
+            array('e' => 'icinga_endpoint'),
+            'e.zone_id = z.id',
+            array()
+        )->join(
+            array('au' => 'icinga_apiuser'),
+            'e.apiuser_id = au.id',
+            array()
         )->where('z.object_name = ?', $this->getMasterZoneName())
          ->order('e.object_name ASC')
          ->limit(1);
@@ -51,7 +55,7 @@ class Db extends DbConnection
         $name = $db->fetchOne($query);
         if (! $name) {
             throw new ConfigurationError(
-                'Unable to detect deployment your endpoint'
+                'Unable to detect your deployment endpoint'
             );
         }
 



More information about the icinga-checkins mailing list