From c9ef9fe91a6ba243e4924915813777f185e6f1c2 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 22 Jun 2016 23:58:09 +0200 Subject: [PATCH] IcingaCommand: fix EventCommand header fixes #12010 --- library/Director/Objects/IcingaCommand.php | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/library/Director/Objects/IcingaCommand.php b/library/Director/Objects/IcingaCommand.php index aefb8c3c..0ae9e9b7 100644 --- a/library/Director/Objects/IcingaCommand.php +++ b/library/Director/Objects/IcingaCommand.php @@ -58,18 +58,27 @@ class IcingaCommand extends IcingaObject protected function renderObjectHeader() { - if ($this->getResolvedProperty('methods_execute') === 'PluginNotification') { - return sprintf( - "%s %s %s {\n", - $this->getObjectTypeName(), - 'NotificationCommand', - c::renderString($this->getObjectName()) - ); + $execute = $this->getResolvedProperty('methods_execute'); + + if ($execute === 'PluginNotification') { + return $this->renderObjectHeaderWithType('NotificationCommand'); + } elseif ($execute === 'PluginEvent') { + return $this->renderObjectHeaderWithType('EventCommand'); } else { return parent::renderObjectHeader(); } } + protected function renderObjectHeaderWithType($type) + { + return sprintf( + "%s %s %s {\n", + $this->getObjectTypeName(), + $type, + c::renderString($this->getObjectName()) + ); + } + public function mungeCommand($value) { if (is_array($value)) {