[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaObjectMultiRelations: fix service relations

git at icinga.org git at icinga.org
Wed Oct 12 11:11:20 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Wed Oct 12 09:11:05 2016 +0000

IcingaObjectMultiRelations: fix service relations

...for sets

---

 library/Director/Objects/IcingaObjectMultiRelations.php |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/library/Director/Objects/IcingaObjectMultiRelations.php b/library/Director/Objects/IcingaObjectMultiRelations.php
index 7b68477..5a5593a 100644
--- a/library/Director/Objects/IcingaObjectMultiRelations.php
+++ b/library/Director/Objects/IcingaObjectMultiRelations.php
@@ -186,7 +186,15 @@ class IcingaObjectMultiRelations implements Iterator, Countable, IcingaConfigRen
 
             $connection = $this->object->getConnection();
             try {
-                $relation = $class::load($relation, $connection);
+                // Related services can only be objects, used by ServiceSets
+                if ($class === 'Icinga\\Module\\Director\\Objects\\IcingaService') {
+                    $relation = $class::load(array(
+                        'object_name' => $relation,
+                        'object_type' => 'template'
+                    ), $connection);
+                } else {
+                    $relation = $class::load($relation, $connection);
+                }
             } catch (Exception $e) {
 
                 switch ($onError) {



More information about the icinga-checkins mailing list