From 2c1f745c4e1bd4c678a9fecde8f2981d2fcda03e Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 7 Nov 2016 11:38:02 +0100 Subject: [PATCH] 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 3c8a13fa..cd9e403b 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 45633528..957aed85 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(