diff --git a/library/Director/CustomVariable/CustomVariables.php b/library/Director/CustomVariable/CustomVariables.php index 01227c597..e8a464983 100644 --- a/library/Director/CustomVariable/CustomVariables.php +++ b/library/Director/CustomVariable/CustomVariables.php @@ -399,10 +399,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 a79bf3c79..32e8cf7bc 100644 --- a/library/Director/IcingaConfig/IcingaConfig.php +++ b/library/Director/IcingaConfig/IcingaConfig.php @@ -553,6 +553,20 @@ protected function renderHostOverridableVars() ) } } + globals.directorMergeOverrideConfig = function(existing,overrides) { + if (existing) { + for (service => conf in overrides) { + if (existing[service]) { + existing[service] += conf + } else { + existing[service] = conf + } + } + return existing + } else { + return overrides + } + } template Service DirectorOverrideTemplate { /**