From 199a46abcbe6edbcd32c9646791238926b438795 Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Thu, 3 Nov 2016 14:16:07 +0100 Subject: [PATCH] IcingaObject(Legacy): Render check_command when inherited, but ARGn is set refs #12919 --- library/Director/Objects/IcingaObject.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php index ce609670..280fb778 100644 --- a/library/Director/Objects/IcingaObject.php +++ b/library/Director/Objects/IcingaObject.php @@ -1984,7 +1984,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer } } - array_unshift($args, $this->get('check_command')); + array_unshift($args, $value); return c1::renderKeyValue('check_command', join('!', $args)); } @@ -2009,7 +2009,20 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer protected function renderLegacyCustomExtensions() { - return ''; + $str = ''; + + // force rendering of check_command when ARG1 is set + if ($this->supportsCustomVars() && array_key_exists('check_command_id', $this->defaultProperties)) { + if ( + $this->vars()->get('ARG1') !== null + && $this->get('check_command') === null + ) { + $command = $this->getResolvedRelated('check_command'); + $str .= $this->renderLegacyCheck_command($command->getObjectName()); + } + } + + return $str; } protected function renderObjectHeader()