[icinga-checkins] icinga.org: icingaweb2-module-director/next: IcingaService: render service_description for v1

git at icinga.org git at icinga.org
Mon Nov 7 11:38:24 CET 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Mon Nov  7 11:38:02 2016 +0100

IcingaService: render service_description for v1

---

 library/Director/Objects/IcingaObject.php  |   13 +++++++++++--
 library/Director/Objects/IcingaService.php |    9 +++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php
index 3c8a13f..cd9e403 100644
--- a/library/Director/Objects/IcingaObject.php
+++ b/library/Director/Objects/IcingaObject.php
@@ -2060,12 +2060,12 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
 
         if ($this->isTemplate()) {
             $name = c1::renderKeyValue(
-                'name',
+                $this->getLegacyObjectKeyName(),
                 c1::renderString($this->getObjectName())
             );
         } else {
             $name = c1::renderKeyValue(
-                $type . '_name',
+                $this->getLegacyObjectKeyName(),
                 c1::renderString($this->getObjectName())
             );
         }
@@ -2083,6 +2083,15 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
         return $str;
     }
 
+    protected function getLegacyObjectKeyName()
+    {
+        if ($this->isTemplate()) {
+            return 'name';
+        } else {
+            return $this->getLegacyObjectType() . '_name';
+        }
+    }
+
     /**
      * @codingStandardsIgnoreStart
      */
diff --git a/library/Director/Objects/IcingaService.php b/library/Director/Objects/IcingaService.php
index 4563352..957aed8 100644
--- a/library/Director/Objects/IcingaService.php
+++ b/library/Director/Objects/IcingaService.php
@@ -257,6 +257,15 @@ class IcingaService extends IcingaObject
         return parent::renderObjectHeader();
     }
 
+    protected function getLegacyObjectKeyName()
+    {
+        if ($this->isTemplate()) {
+            return 'name';
+        } else {
+            return 'service_description';
+        }
+    }
+
     protected function hasBeenAssignedToHostTemplate()
     {
         return $this->host_id && $this->getRelatedObject(



More information about the icinga-checkins mailing list