From 19a92b1befce4778c5a2939cbf4286909562cd22 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 17 Feb 2016 16:42:42 +0100 Subject: [PATCH] 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 b659975c..90627daa 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' ); }