IcingaCommand: fix EventCommand header

fixes #12010
This commit is contained in:
Thomas Gelf 2016-06-22 23:58:09 +02:00
parent bde3830369
commit c9ef9fe91a
1 changed files with 16 additions and 7 deletions

View File

@ -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)) {