[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaObject: fix v1 rendering for some properties

git at icinga.org git at icinga.org
Wed Oct 12 10:31:54 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Wed Oct 12 08:31:22 2016 +0000

IcingaObject: fix v1 rendering for some properties

Mostly relations, no timeout, still ugly

---

 library/Director/Objects/IcingaObject.php     |   18 +++++++++++++++++-
 library/Director/Objects/IcingaServiceSet.php |   10 ----------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php
index 92f76b7..8410ede 100644
--- a/library/Director/Objects/IcingaObject.php
+++ b/library/Director/Objects/IcingaObject.php
@@ -1405,7 +1405,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
     {
         return $this->renderLegacyObjectProperty(
             $renderKey ?: $propertyName,
-            c::renderString($this->getRelatedObjectName($propertyName, $id))
+            c1::renderString($this->getRelatedObjectName($propertyName, $id))
         );
     }
 
@@ -1418,6 +1418,16 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
     /**
      * @codingStandardsIgnoreStart
      */
+    protected function renderLegacyHost_id()
+    {
+        return $this->renderLegacyRelationProperty('host', $this->host_id, 'host_name');
+    }
+
+    protected function renderLegacyTimeout()
+    {
+        return '';
+    }
+
     protected function renderLegacyEnable_active_checks()
     {
         return $this->renderLegacyBooleanProperty(
@@ -1614,6 +1624,12 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
             }
         }
 
+        if (substr($key, -3) === '_id'
+             && $this->hasRelation($relKey = substr($key, 0, -3))
+        ) {
+            return $this->renderLegacyRelationProperty($relKey, $value);
+        }
+
         return c1::renderKeyValue($key, c1::renderString($value));
     }
 
diff --git a/library/Director/Objects/IcingaServiceSet.php b/library/Director/Objects/IcingaServiceSet.php
index 356997d..4e40741 100644
--- a/library/Director/Objects/IcingaServiceSet.php
+++ b/library/Director/Objects/IcingaServiceSet.php
@@ -170,14 +170,4 @@ class IcingaServiceSet extends IcingaObject
     {
         return $this->connection->getDefaultGlobalZoneName();
     }
-
-    public function xxisObject()
-    {
-        return true;
-    }
-
-    public function getUrlParams()
-    {
-        return array('name' => $this->object_name);
-    }
 }



More information about the icinga-checkins mailing list