Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix service inheritance with overrides on multiple nested levels #2414

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions library/Director/CustomVariable/CustomVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
14 changes: 14 additions & 0 deletions library/Director/IcingaConfig/IcingaConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/**
Expand Down
Loading