diff --git a/library/Director/CustomVariable/CustomVariables.php b/library/Director/CustomVariable/CustomVariables.php index 848adb902..fbed9fd56 100644 --- a/library/Director/CustomVariable/CustomVariables.php +++ b/library/Director/CustomVariable/CustomVariables.php @@ -393,10 +393,9 @@ public function toLegacyConfigString() protected function renderSingleVar($key, $var, $renderExpressions = false) { if ($key === $this->overrideKeyName) { - return c::renderKeyOperatorValue( + return c::renderKeyValue( $this->renderKeyName($key), - '+=', - $var->toConfigStringPrefetchable($renderExpressions) + 'directorMergeOverrideConfig('.$this->renderKeyName($key) . ', ' . $var->toConfigStringPrefetchable($renderExpressions).')' ); } else { return c::renderKeyValue( diff --git a/library/Director/IcingaConfig/IcingaConfig.php b/library/Director/IcingaConfig/IcingaConfig.php index 72edd7eeb..24cbb1df9 100644 --- a/library/Director/IcingaConfig/IcingaConfig.php +++ b/library/Director/IcingaConfig/IcingaConfig.php @@ -540,6 +540,20 @@ protected function renderHostOverridableVars() ) } } + globals.directorMergeOverrideConfig = function(existing,overrides) { + if (existing) { + for (var service => conf in overrides) { + if (existing[service]) { + existing[service] += conf + } else { + existing[service] = conf + } + } + return existing + } else { + return overrides + } + } template Service DirectorOverrideTemplate { /**