[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaCommand: fix EventCommand header

git at icinga.org git at icinga.org
Wed Jun 22 23:58:36 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Wed Jun 22 23:58:09 2016 +0200

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 aefb8c3..0ae9e9b 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)) {



More information about the icinga-checkins mailing list